reselect icon indicating copy to clipboard operation
reselect copied to clipboard

createSelector w/o dependencies

Open pheara opened this issue 10 years ago • 2 comments

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.

pheara avatar Feb 24 '16 18:02 pheara

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.

ellbee avatar Feb 24 '16 20:02 ellbee

just use the bare function

What if we want memoization?

OliverJAsh avatar Jan 08 '19 12:01 OliverJAsh