useReselect
DEVELOPMENT PREVIEW
This is a fork of reselect, mixed with kashe and React hooks
.
API
API is 100% compatible with Reselect.
createSelector
- as seen in reselect
Hooks
useReselect
useReselect(cb)
- selection runner. All selectors inside would be executed inside a sandbox, making result instance bound.
const getUser = ; const User = { const userName = ; return <span>: userName</span>} // this would work<> <User userId="user1" /> <User userId="user2" /> </> // this would not, getUser still could hold only one resultconst DoubleUser = { const u1 u2 = ; return <span>u1 - u2</span>}
useReReselect
useReReselect(cb)
- selection runner. Every selector inside would be executed in a personal sandbox, making it instance bound
// every selector would be executed in a personal sandboxconst DoubleUser = { const u1 u2 = ; return <span>u1 - u2</span>}
Running selectors without React
// run it onceconst u1 u2 = ;// get "hooks"const stack = useReReselect; // run it with "custom hooks"const u1 u2 = ;
Sharing results
All selectors are double memoized, letting shareable data be shared.
License
MIT