Book description
Build consistent web apps with Redux by easily centralizing the state of your application.
About This Book
- Write applications that behave consistently, run in different environments (client, server and native), and are easy to test
- Take your web apps to the next level by combining the power of Redux with other frameworks such as React and Angular
- Uncover the best practices and hidden features of Redux to build applications that are powerful, consistent, and maintainable
Who This Book Is For
This book targets developers who are already fluent in JavaScript but want to extend their web development skills to develop and maintain bigger applications.
What You Will Learn
- Understand why and how Redux works
- Implement the basic elements of Redux
- Use Redux in combination with React/Angular to develop a web application
- Debug a Redux application
- Interface with external APIs with Redux
- Implement user authentication with Redux
- Write tests for all elements of a Redux application
- Implement simple and more advanced routing with Redux
- Learn about server-side rendering with Redux and React
- Create higher-order reducers for Redux
- Extend the Redux store via middleware
In Detail
The book starts with a short introduction to the principles and the ecosystem of Redux, then moves on to show how to implement the basic elements of Redux and put them together. Afterward, you are going to learn how to integrate Redux with other frameworks, such as React and Angular.
Along the way, you are going to develop a blog application. To practice developing growing applications with Redux, we are going to start from nothing and keep adding features to our application throughout the book. You are going to learn how to integrate and use Redux DevTools to debug applications, and access external APIs with Redux. You are also going to get acquainted with writing tests for all elements of a Redux application. Furthermore, we are going to cover important concepts in web development, such as routing, user authentication, and communication with a backend server
After explaining how to use Redux and how powerful its ecosystem can be, the book teaches you how to make your own abstractions on top of Redux, such as higher-order reducers and middleware.
By the end of the book, you are going to be able to develop and maintain Redux applications with ease. In addition to learning about Redux, you are going be familiar with its ecosystem, and learn a lot about JavaScript itself, including best practices and patterns.
Style and approach
This practical guide will teach you how to develop a complex, data-intensive application leveraging the capabilities of the Redux framework.
Table of contents
- Preface
- Why Redux?
- Implementing the Elements of Redux
-
Combining Redux with React
- Why React?
- Setting up React
- First steps with React
- Connecting React to Redux
-
Building an application with Redux and React
- The goal
- Project structure
- Defining the application state
- Defining action types and action creators
- Implementing reducers
- Setting up the Redux store
- Code example – Redux-only application
- Implementing the user interface
- Code example – React/Redux application
- Further tasks
- Summary
- Combining Redux with Angular
-
Debugging a Redux Application
-
Integrating Redux DevTools
- Installing Redux DevTools
- Creating a DevTools component
- Connecting DevTools to Redux
- Excluding Redux DevTools in production
- Setting up hot reloading
- Using Redux DevTools
- Summary
-
Integrating Redux DevTools
-
Interfacing with APIs
- Setting up the backend
- Handling asynchronous operations with Redux
- Pulling data from an API into the Redux store
- Sending notifications to an API via Redux
- Summary
- User Authentication
- Testing
-
Routing
- Creating a simple router
- Using a routing library
- Using react-router-redux
- Summary
-
Rendering on the Server
- Why render on the server?
- Preparing for server-side rendering
- Implementing server-side rendering
- Performance improvements
- Summary
-
Solving Generic Problems with Higher-Order Functions
- Making functions pure
- Creating higher-order functions
- Solving generic problems with Redux
-
Implementing generic undo/redo Redux
- Setting up the counter application
- Looking at the counter reducer
- Implementing undo/redo in the counter application
-
Implementing a generic undo/redo higher-order reducer
- Defining the undoable higher-order reducer
- Defining the initial state
-
Handling generic undo/redo actions
- Defining the action types
- Defining the action creators
- Implementing the enhanced reducer
- Handling the undo action
- Handling the redo action
- Handling other actions (updating the present state)
- Removing undo/redo logic from the counter reducer
- Wrapping the counter reducer with undoable
- Problems with our simple undoable higher-order reducer
- Example code
- Implementing redux-undo
- Summary
- Extending the Redux Store via Middleware
Product information
- Title: Learning Redux
- Author(s):
- Release date: August 2017
- Publisher(s): Packt Publishing
- ISBN: 9781786462398
You might also like
book
Learning React
If you want to learn how to build efficient user interfaces with React, this is your …
video
Redux Recipes
State management is absolutely critical in providing users with a well-crafted experience with minimal bugs. Redux …
video
Redux in Motion
See it. Do it. Learn it! Redux in Motion introduces you to the powerful Redux library …
book
Building React Apps with Server-Side Rendering: Use React, Redux, and Next to Build Full Server-Side Rendering Applications
Leverage the benefits of both client-side and server-side rendering to get the most out of your …