Displayname
Displayname

Reputation: 55

How to pass multiple parameters to selector function?

I would like to make a selector function like so:

const selectSomethingById = (state, id) => return state.something[id];

I cannot make it to work. I would have some components calling it like so:

const something = useSelector(selectSomethingById(id));

Upvotes: 0

Views: 577

Answers (1)

jove0610
jove0610

Reputation: 854

const something = useSelector(state => selectSomethingById(state, id))

Upvotes: 1

Related Questions