vue-redux-composable
v1.0.0
Published
Redux bindings for vue as a vue composable.
Downloads
11
Maintainers
Readme
vue-redux-composable
Mainly inspired by react-redux
npm package (https://github.com/reduxjs/react-redux)
Exposed function
provideStore(store)
- Need to be call in
setup()
(https://composition-api.vuejs.org/api.html#setup) - Provide your store to an HOC (as
App.vue
) and to this lib.
- Need to be call in
useStore()
- Need to be call in
setup()
(https://composition-api.vuejs.org/api.html#setup) - Provide the redux
store
.
- Need to be call in
useSelector(selector)
- Return a
ref()
where thevalue
property is reactively change if the state is updated. (https://composition-api.vuejs.org/api.html#ref)
- Return a
useDispatch()
- Return
dispatch
- Return
Simple use case
How to provide your
store
to the lib :- https://github.com/Cjumelin/Vue3-vite-redux-demo/blob/master/src/App.vue
How to use it in
setup()
:- https://github.com/Cjumelin/Vue3-vite-redux-demo/blob/master/src/uiComponent/thingList/thingList.ts