While this is a bare state management mechanism, it is not a replacement for redux. Here all components subscribed to the context will rerender when any value in the context changes.
When you use redux, only the components subscribed to that particular state rerenders on state change - even though there is a single global store.
I am a Full Stack Javascript Engineer with robust problem-solving skills and proven experience in creating and designing web apps in a test driven environment and deploy them to cloud servers.
Good point. Is there a way to use something to prevent the subscribed components to rerender if not needed? Thinking about something like memo where it does shallow comparison on props object?
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.
While this is a bare state management mechanism, it is not a replacement for redux. Here all components subscribed to the context will rerender when any value in the context changes.
When you use redux, only the components subscribed to that particular state rerenders on state change - even though there is a single global store.
What if the context api is used with reducer? more complex but interesting thing to do.
Good point. Is there a way to use something to prevent the subscribed components to rerender if not needed? Thinking about something like memo where it does shallow comparison on props object?