You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure how I should implement reselect to have the same behavior as re-reselect with the cache-key.
Here is a simple example of a selector that may be used a lot of time in my app, so I want to prevent any re-computation of myExpensiveComputation if the selectBookById has no changed.
In re-reselect
importcreateCachedSelectorfrom're-reselect'constselectBookById=(state,id: string)=>state.books[id]constmyExpensiveComputation=()=>// stuffconstmyCachedSelector=createCachedSelector(selectBookById,myExpensiveComputation)((_,id)=>id))// here is the cache key
In reselect 4.1.0
import{createSelector}from'reselect'constselectBookById=(state,id: string)=>state.books[id]constmyExpensiveComputation=()=>// stuffconstmyCachedSelector=createSelector(selectBookById,myExpensiveComputation,{memoizeOptions: {maxSize: 50,// Set size to 50, so if multiple components are connected to the same selector, it will not recompute}})
The text was updated successfully, but these errors were encountered:
Hi, this is more a question than a real issue.
I am not sure how I should implement reselect to have the same behavior as re-reselect with the cache-key.
Here is a simple example of a selector that may be used a lot of time in my app, so I want to prevent any re-computation of
myExpensiveComputation
if theselectBookById
has no changed.In re-reselect
In reselect 4.1.0
The text was updated successfully, but these errors were encountered: