Mainly inspired by react-redux
npm package (https://github.com/reduxjs/react-redux)
-
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
-
How to provide your
store
to the lib : -
How to use it in
setup()
: