reselect
reselect copied to clipboard
createSelector w/o dependencies
It's really minor - we've got the following code in our project:
export const selectAllByConnections = createSelector(
state => state, //reselect's createSelector always needs a dependency
state => state
.get('connections')
.map(connection => allByConnection(connection)(state))
);
I can't move the state.get('connections') to a different selector as i require the full state for the core selection task.
There is no need for a selector in this case, just use the bare function. createSelector creates a selector that memoizes on its arguments, so using createSelector without dependencies is essentially a no-op.
just use the bare function
What if we want memoization?