This post isn’t about whether or not there are benefits to learning Redux but rather whether or not it’s going to solve the current “problems” you want to address. According to Senior Nona Developer, James Smith, the answer is probably “sooner rather than later” but you’re going to need to decide for yourself.
When you should
- If you need to share state.
- If you want global components to be accessed from anywhere.
- If you’re well-versed in React and have already explored your options without Redux before you dive in. Robin Wieruch recommends learning these 8 things in React before getting into Redux.
- If setState bloats the code and it becomes too difficult to manage.
- If users expect to often return to see the same page state and you want to keep the backend streamlined.
- If you want faster, more efficient performance.
When it could wait
- If you’ve just started learning React, Co-Author of React Dan Abramhov suggests you first learn to “Think in React”. You can read more about this here.
- If you didn’t know that you can implement ideas from Redux using a React component. Using setState, for example, could be sufficient.
- If you’re working on a simple project in terms of how many different components there are to it.
- You could use Apollo to build a universal GraphQL API on top of your existing REST APIs.
- Some developers report learning Redux in about 6 weeks but there are others who are still perfecting it over two years later.
- There are a number of resources to help you get to grips with Redux, that appeal to various learning styles. Try: LearnRedux and Getting Started with Redux.
- Ask yourself: How many projects will you have in future that will likely require Redux, i.e. is it worth it in the longer term?
Comparatively speaking, learning Redux doesn’t take that long to do and using it can help you ensure your site or app’s scalability, cleaner code on the backend and a faster more efficient end-product. Chances are, if you don’t need it now, you will soon.