import { useEffect } from 'react'
import useReduxState, { action } from 'use-redux-states'
const Component = () => {
useReduxState({
state: {
state1: 'a',
state2: 'b'
},
path: 'component_state'
})
useEffect(() => {
store.dispatch(
action(
'component_state',
{ state2: 'c' },
(component_state, payload) => ({ ...component_state, ...payload })
)
)
}, [])
}