Releases: ashish-r/create-global-state-selector
Releases · ashish-r/create-global-state-selector
v1.1.3
What's New?
Documentation update.
Uses:
import `createGlobalStateSelector` from 'create-global-state-selector'
Example:
const store = { a: { b: { x: 55, y: 65, z: 'temp' } } };
Pass an object of local slice selectors
const { selectX, selectY, selectZ } = createGlobalStateSelector(
{
selectX: (state: Record<string, any>): number => state.x,
selectY: (state: Record<string, any>): number => state.y,
selectZ: (state: Record<string, any>): string => state.z
},
'a',
'b'
);
// Final store signature after combineReducers
const store = { a: { b: { x: 55, y: 65, z: 'temp' } } };
selectX(store); // 55
selectY(store); // 65
selectZ(store); // 'temp'
Pass a local slice selector
const selectZ = createGlobalStateSelector((state: Record<string, any>): number => state.z, 'a', 'b');
// Final store signature after combineReducers
const store = { a: { b: { x: 55, y: 65, z: 'temp' } } };
selectZ(store); // 'temp'
v1.1.2
What's New?
Documentation update.
Uses:
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'
v1.1.1
What's New?
Documentation update.
Uses:
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'
v1.1.0
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'
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'