I took a look at the src code for createSelectorCreator and it seems to be pretty agnostic about a redux store. in fact, if state (and the Redux store is just a plain object) changes, we could get the same benefits of memoized/pre-computed state.
Say I have the results of a GraphQL query within a React Query component. If you don't have background, it's a HOC that reactively executes or passes a cached result of a GraphQL query.
So if within the component, we have:
<Query query={apolloQuery}>
const { bob } = apolloQueryResults // aliased. it normally comes through as data
const props = {
prop1: memoizedPrecomputedSelector(bob)
}
return <ReactComponent { ...props}/>
</Query>
Would this achieve the same effect of memoization?
While Reselect is commonly used with Redux (and we recommend they be used together), Reselect is a totally generic memoization library. You can use it with values from React component state, or anything else.
yeehaw! that's awesome thanks
Most helpful comment
While Reselect is commonly used with Redux (and we recommend they be used together), Reselect is a totally generic memoization library. You can use it with values from React component state, or anything else.