Package Exports
- @zhourengui/vue3redux
- @zhourengui/vue3redux/dist/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 vue3redux
# or
yarn add vue3redux
Basic Example
Install 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 vue3redux
in component
<template>
<p>Count is: {{ counter.value }}</p>
<button @click="() => dispatch(increment())">Increment Count</button>
</template>
<script setup lang="ts">
import { useSelector, useDispatch } from 'vue3redux';
import { increment } from 'stores/index';
import type { RootState } from 'stores/index';
const dispatch = useDispatch();
const counter = useSelector<RootState>((state) => state.counter);
</script>
Examples
Todo List
- Add Tests