20

Using Redux with React

Now that you have a better idea of how Redux works, let’s look at the topic we set out to better understand in the first place. Why is Redux so popular in React projects? To help answer this, take a look at the following component hierarchy for some arbitrary app:

A component hierarchy shows several components (represented as colored circles). The parent nodes attach to an element "ReactDOM.render()."

What this app does isn’t very important. The only detail we’ll throw in here is that some of these components are responsible for managing state and transferring some of that state around in the form of props:

The component hierarchy of an app is shown. Three components (two parents and one child) are shown to enclose the "Store" symbol in them.

In an ideal setup, the data that each component ...

Get Learning React: A Hands-On Guide to Building Web Applications Using React and Redux, Second edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.