Data Down, Actions Up

Next, you will add a component to be controlled by a state change in the application. Specifically, you will create a flash alert to display a message when you create a new listing.

One of the tenets of components is “data (or state) down and actions up.” Unlike controllers, components should not change the state of an application; they should pass changes up through actions. The state of a component, on the other hand, should be passed in from a parent template – data down (Figure 25.2).

Figure 25.2  Component Data Down Actions Up

Component Data Down Actions Up

A component could easily replace a controller by passing a route’s model ...

Get Front-End Web Development: The Big Nerd Ranch Guide 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.