-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use useAppSelector with nested combineSlices? #4477
Comments
The slice selectors give you the slice state as the argument, but they default to assuming that the slice itself is already in So, you can already pass |
when your slice is nested, you need to call For example, your case would be: const { getIsDirectoryDrawerOpen } = ui.getSelectors((state: RootState) => ui.selectSlice(state.state1)) |
Whoops, my bad, I misread the original question, sorry! |
Sweet, |
Sorry if this is in the docs somewhere, I couldn't find it. If have a slice with
selectors
, like this:and that slice is in a nested part of the state, like this:
At the component level, if I wanna call
getIsDirectoryDrawerOpen
, do I have pass in the nested state to the selector like this?Just wondering if there's not a way to set it to just do
useAppSelector(getIsDirectoryDrawerOpen);
Thanks!
The text was updated successfully, but these errors were encountered: