In my previous post, “Starting a New App With Redux? Consider Context API First”, I wrote about the Context API as a viable alternative to Redux. In this post, I want to show how a React application using Redux looks when using the Context API.

First Considerations

I’m assuming that my previous article intrigued you enough that you’re considering migrating away from Redux. You have to ask yourself: Is migration worth it? The approach based on the Context API might be simpler, but that’s not enough of an argument on its own to rewrite perfectly functional code.

I can’t tell you if your situation merits the change or not. You have to consider your circumstances and decide based on that. Here are some helpful questions:

  • Is this application likely to change? The benefits of a simpler codebase become apparent when people are regularly working on it.
  • Is this application safe to change? Without a solid base of tests to rely on, a major refactoring is doomed to fail.
  • Does it make sense from a business perspective? I get it. Developers love to work on restructuring their applications. But without alignment with your stakeholders, they may perceive it as technology for the sake of technology.

#redux

From Redux to the Context API: A Practical Migration Guide
1.70 GEEK