Chapter 3. Data and data flow in React
This chapter covers
- Mutable and immutable state
- Stateful and stateless components
- Component communication
- One-way data flow
Chapter 2 was a whirlwind tour of React. We spent some time learning about React at a high level, looked at some of the concepts behind its design and API, and we even went through building a simple comment box with React components. In chapter 4 you’ll start to work more extensively with components and start building the Letters Social sample project. But before you do that, you need to know a little bit more about how to work with data in React and understand how it flows in React applications. That’s what this chapter is about.
Chapter 2 gave you a few glimpses of working with data in React components, but we’ll need to spend more time focusing on it if you want to build more substantial React applications. In this section, you’ll learn about the following:
- State
- How React handles state
- How data flows through components
Modern web applications are usually built as data-first applications. Granted, there are many static sites (my blog is one—https://ifelse.io), but even these are updated over time and generally considered to be in a different category from modern web applications. Most web apps that people use on a regular basis are highly dynamic and filled with data that changes over time.