Repository navigation
Safe to pass different input selectors from different slices? #590
|
I was wondering if it's safe to pass two input selectors in If it is actually safe, then would it be better to create the selector instance in one of those slices or in the component where it is being used? |
Answered by
markerikson
Nov 27, 2022
Replies: 1 comment
|
Sure, there's no problem there. In fact, that's part of the point of selectors in the first place - to encapsulate looking up date from different parts of the state. We typically recommend defining selectors in a slice file, but it's up to you - Redux doesn't care where the selector function actually lives. See https://redux.js.org/usage/deriving-data-selectors for more details. |
0 replies
Answer selected by
n-ii-ma
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure, there's no problem there. In fact, that's part of the point of selectors in the first place - to encapsulate looking up date from different parts of the state.
We typically recommend defining selectors in a slice file, but it's up to you - Redux doesn't care where the selector function actually lives.
See https://redux.js.org/usage/deriving-data-selectors for more details.