How to use createSelectorHook() #1907
-
I am receiving this error on CodeSandbox: Cannot read properties of undefined (reading 'getState') What is the proper way to use createSelectorHook()? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Remove that code and you are already set up. const Counter = (props) => {
return (
- <context.Provider value={props}>
<A />
- </context.Provider>
);
}; But please be aware that you should do that very rarely and in almost all instances should not have multiple stores in your applciation. Also, please note that you are writing a very outdated style of Redux here and should be using the official Redux Toolkit instead of writing |
Beta Was this translation helpful? Give feedback.
-
ok....after removing those two lines, how do I pass a context value (eg. step) down the components hierarchy? |
Beta Was this translation helpful? Give feedback.
-
FWIW, in normal usage you do not need to create a custom context instance for use with React-Redux. Can you clarify what you're actually trying to accomplish overall? What are you working on that you feel needs to make use of a custom context instance here? |
Beta Was this translation helpful? Give feedback.
FWIW, in normal usage you do not need to create a custom context instance for use with React-Redux.
Can you clarify what you're actually trying to accomplish overall? What are you working on that you feel needs to make use of a custom context instance here?