DEV Community

salman6abbas
salman6abbas

Posted on

Difference between Redux and Context API

So I was having an interview and I was asked to tell about the difference between redux and React's context api. First of all I was blown like nothing came to my mind and then I was like Redux contains a lot of boiler plate while context is very much simpler. I even went after saying even its cofounder Dan Abramov said he doesn't like using Redux.
Well he insisted like no there's other main difference regarding the scope that you have to tell. Well I gave up and then he told me that redux is global scope while context was components scope. Since then I kind of couldn't get over it. Like if this is the case then learning redux (although I don't like it) is essential as more and more companies are using it. What is your stance on it. Will be very glad to see the responses.

Top comments (1)

Collapse
 
markerikson profile image
Mark Erikson • Edited

Hi, I'm a Redux maintainer. Trust me, I hear this question all the time, and there are a lot of differences :) That's why I've written multiple blog posts that answer this question and provide information about the differences between Context and Redux, how they work, and when you should use them:

Also, I have to point out that "modern Redux" with our official Redux Toolkit package and the React-Redux hooks API solved all the "boilerplate" concerns. It's way easier to learn and use Redux today. Please see our official Redux docs tutorials (unfortunately most other tutorials online are very outdated):

Hope those help!