The example code for creating a selector that uses the props is as follows:
const makeMapStateToProps = () => {
const getVisibleTodos = makeGetVisibleTodos()
const mapStateToProps = (state, props) => {
return {
todos: getVisibleTodos(state, props)
}
}
return mapStateToProps
}
connect(makeMapStateToProps)(Component);
However, this means the memoized selectors will be lost after the component gets unmounted (unlike the selectors defined in a file).
Is there a way in Reselect library to save these selectors?
If not, what would be the best approach of saving them? I am thinking of caching, but I would need one selector for every value.