Skip to main content
Version: 1.0.x

selector()

function to select state for a given state path.

selector(storeRootState, stateName)

Returns Redux state for the given path

Example#

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