Reputation: 3988
I'm having an issue integrating reselect
when using react-redux
's useSelector
hook.
For some reason, the state in my selector is always undefined.
I reproduced it in this sandbox.
(Take a look at the Simple.js
component). The state is fine in the useSelector
hook but is then undefined when inside the selector. I added console logs that demonstrate the issue.
What am I doing wrong?
Upvotes: 2
Views: 4133
Reputation: 53884
You didn't provide a result function:
const selector = createSelector(
state => ({
...state.reducer
}),
state => state
);
According to the API docs:
createSelector(...inputSelectors | [inputSelectors], resultFunc)
Upvotes: 3