Chapter 3. Understanding Properties and State

React components rely on JSX syntax, which is used to describe the structure of the UI. JSX will only get us so far—we need data to fill in the structure of our React components. The focus of this chapter is component data, which comes in two varieties: properties and state.

We'll start things off by defining what is meant by properties and state. Then, we'll walk through some examples that show you the mechanics of setting component state, and passing component properties. Toward the end of this chapter, we'll build on your new-found knowledge of props and state and introduce functional components and the container pattern.

What is component state?

React components declare the structure of a UI element ...

Get React and React Native 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.