JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q19262F
  • License MIT

Package Exports

  • @zhourengui/vue3redux
  • @zhourengui/vue3redux/lib/es/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@zhourengui/vue3redux) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Vue3Redux

Provide Hooks for projects using Redux in Vue3

Installation

npm install @zhourengui/vue3redux
# or
yarn add @zhourengui/vue3redux

Basic Example

Install @zhourengui/vue3redux plugin
import { createApp } from '@vue/runtime-dom';
import { createVue3redux } from '@zhourengui/vue3redux';

import App from './app.vue';
import { store } from './stores';

const vue3redux = createVue3redux();

const app = createApp(App);

app.use(vue3redux, { store: store });

app.mount('#app');
Used @zhourengui/vue3redux in component
<template>
  <p>Count is: {{ counter }}</p>
  <button @click="() => dispatch(increment())">Increment Count</button>
  <button @click="() => dispatch(decrement())">Decrement Count</button>
  <button @click="() => dispatch(incrementByAmount(100))">
    Increment By Amount
  </button>
  <p>Author: {{ author.name }}, {{ author.github }}</p>
  <button
    @click="
      () =>
        dispatch(
          restoreAuthor({
            name: `Rengui Zhou ${Math.random()}`,
            github: 'https://github.com/zhourengui',
          })
        )
    "
  >
    Change Author
  </button>
</template>

<script setup lang="ts">
  import { useSelector, useDispatch } from '@zhourengui/vue3redux';
  import {
    increment,
    decrement,
    incrementByAmount,
    RootState,
    demoSlice,
    restoreAuthor,
  } from './stores';

  const { counter, author } = useSelector(
    (store: RootState) => store[demoSlice.name]
  );

  const dispatch = useDispatch();
</script>

Examples

Counter: Source | Sandbox

Todo List

  • Add Tests