oberprah
oberprah

Reputation: 187

Create simple selector functions with redux-toolkit

Is there a way to create the simple selector functions automatically when I use the createSlice function from the redux-toolkit?

Upvotes: 5

Views: 8755

Answers (1)

markerikson
markerikson

Reputation: 67489

No, createSlice does not currently generate any selector functions for you. (We did originally have a "slice selector" that was generated, but we removed that in v0.7.0 as it wasn't actually useful for anything.)

You should call import and call createSelector yourself as appropriate. See these Redux docs pages for more info on using createSelector to create memoized selectors:

Upvotes: 8

Related Questions