useSelector with several dependencies #2056
Antonio592021
started this conversation in
General
Replies: 1 comment
-
What you've got seems fine to me. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi.
I started migrating my application from connect to useSelector, and i started to face some situations that bothers me.
The problem comes when i have a normalized store and i need selectors to derive data that depends of other selectors derived data, that depends of more selectors inside of them.
According to the hypothetical situation from my imagination below:
(ignore the fact that i could do things differently)
Lets say i want to derive the invoice total price
As you can see, im starting to pass all the states as dependencies to each selector.
Is there a cleaner way to do this?
I could simple access the store.getState or useSelector inside of each selector, to get the piece of state that i need.
But is that an appropriate aproach?
Beta Was this translation helpful? Give feedback.
All reactions