Version: 1.0.x
useReduxState()
This hook allows to create redux state at runtime.
or
returns{}#
config#
path''#
type: string
default: Date().getTime()
nestable key path of the redux state
state?#
type: any
initial state
reducer()?#
type: function
function that takes the current state for the given path, payload and returns computed new state.
this function runs once during the initialization of the state
use the function when you want to manually handle how the state should be created/updated.
in the above example reducer had prevented from over-writing the store state when there is an existing value for the state. instead of:
we got:
unmount?#
type: boolean default: false
determines whether redux state should mount
cleanup?#
type: boolean
determines whether redux state should cleanup the state when component unmounted from view.