Using Redux for Web App Development
By: Nikki Dent
What is Redux?
To understand Redux, it’s important to understand the concept of “state.” A helpful way to think of a state is to imagine a container that holds all user data right in your web browser. As you interact with an app, the selections you make and other data you input can all be considered the "state" of the application. What Redux does is unify the storage and management of this state, which is always up-to-date even as data is changed and updated by user actions. Before state management tools like Redux, developers had to rework data for separate parts of the app or pass the state to another location using tools that weren’t designed for state management.
An example of how we’ve used Redux effectively is in a web application where customers can get a quote for service and then act on the quote and complete the purchase. We begin with the quote the user receives for the service, and as they fill in the details for their order, we build up state in Redux, which is stored in the customer’s browser so they can come back and finish the order later on.
Benefits and Drawbacks
Using Redux in development not only keeps your code cleaner, which means testing is easier, but it also flexible enough to work within a variety of front-end frameworks. So, you can take the same Redux implementation being used in a web app and change the frontend to make a native mobile app or a server-based app, allowing great flexibility. Redux also interacts well with legacy web development tools like jQuery and AngularJS, making expansion of your existing applications easy.
With all these helpful benefits, it can be tempting to start with Redux by default, especially if you're using React already, but it doesn’t always make sense to do so. If your app is primarily presentational, for example, you probably don’t need a tool like Redux. Additionally, Redux implementations can be intricate and involve many steps. This can lead to a relatively steep conceptual learning curve for those unfamiliar with functional programming.
About Nikki Dent
Nikki is a technical copywriter for Aptera. With a bachelor’s degree in writing from Saint Mary’s College, Notre Dame, Ind., she has been honing her craft of marketing copywriting for the past five years. In her role at Aptera, Nikki enjoys learning and writing about the technology and strategy at work across the company.