O'Reilly logo

Developing a React Edge, 2nd Edition by Simon Højberg, Frankie Bagnardi, Richard Feldman

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

Chapter 4. Data flow

In React, data flows in one direction only—from the parent to the child. This makes components really simple and predictable. They take props from the parent and render them. If a prop is changed at the top-level component, React will propagate that change all the way down the component tree and re-render all of the components that used that property.

Components can also have internal state, which should only be modified within the component. React components are inherently simple, and you can consider them as a function that take props and state and outputs a virtual DOM representation.

In this chapter we look will look at:

  • What props are
  • What state is
  • When to use props and when to use state

Props

props, short for “properties” ...

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