v1.0.8
import createGlobalStateSelector
from 'create-global-state-selector'
Example:
const store = { a: { b: { x: 55, y: 65, z: 'temp' } } };
-
Pass object of selector functions
const { selectX, selectY } = createGlobalStateSelector( { selectX: (state: Record<string, any>): number => state.x, selectY: (state: Record<string, any>): number => state.y, }, 'a', 'b' ); selectX(store) // 55 selectY(store) // 65
-
Pass one selector function
const selectZ = createGlobalStateSelector( (state: Record<string, any>): number => state.z, 'a', 'b' ); selectZ(store) // 'temp'