DEV Community

sunflowerseed
sunflowerseed

Posted on

Do we really use useContext() in React?

It was once said that we either just React and state, or React with Redux or MobX, and that we really don't use Context.

The reason was that any change in Context may cause every single component to be re-rendered, versus, if we use Redux, then the global store passes the value in as props, so that only the "affected" components get re-rendered.

Is that still the case with useContext() or Context API?

I read the React Hooks docs and it said that the 3 most used Hooks are useState, useEffect, and useContext, so it kind of get me puzzled that I thought Context is rarely used.

Discussion (0)