Another dev (way more experienced than me) also mocks useSelector.
I would like to see the "official" way work, but so far I'm still stuck.
In my component, a useSelector that includes the callback definition works. However, any useSelector that requires an imported callback seems to remain undefined.
I am happy to report that my issue was a mistake in my definitions of my selector functions in my slice. Turns out I needed to type as RootState and then include the reducer in the return (i.e., state.system.chosenMappingService).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Another dev (way more experienced than me) also mocks
useSelector
.I would like to see the "official" way work, but so far I'm still stuck.
In my component, a
useSelector
that includes the callback definition works. However, anyuseSelector
that requires an imported callback seems to remain undefined.This works:
This returns undefined:
And from my slice:
I remain confused.
I am happy to report that my issue was a mistake in my definitions of my selector functions in my slice. Turns out I needed to type as
RootState
and then include the reducer in the return (i.e.,state.system.chosenMappingService
).