O'Reilly logo

React Components by Christopher Pitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Flux

At this stage, we encounter the first design pattern (and the improvements we can make). Flux is a pattern proposed by Facebook that defines the flow of data in an interface.

Note

Flux is not a library, but Facebook has released a few tools that help implement the design pattern. You don't have to use those tools to implement Flux. To install it, run npm install --save flux in addition to the previous dependencies.

We implemented something very close to Flux, but our implementation is at a slight disadvantage. Our Backend class does too much. We call it directly to add and fetch pages. It emits events when new pages are added. It's tightly coupled with the components that use it.

So, we'd have a hard time replacing it with a new Backend class ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required