Often, you may find that state needs to be moved from a child component into a parent. This process is called lifting state up, and it is quite common. In this video, learn how to lift the state data related to status messages so all components can use it.
- [Instructor] Now we have a status updater … that can read messages from our little API … and post new ones. … But to see the new ones, we have to reload the page. … In this video, we'll start fixing that problem … using a very common task in React, lifting up state. … We want to let this post form … add to the list of status messages … when it sends a new one to the API. … React's data flow is one way, downhill only, … from parents to children via props. … These two components are siblings … and they can't talk to each other directly. … In order for both of them to be able to access … the messages state, which is currently … in the message list component, … we need to lift it out of there, into their shared parent. … During the planning phase, we'll often catch … possible issues like this before we even start, … but sometimes we don't and in the course of building a site, … needs can change, so this is a very common exercise … that's worth going through now. … And it's not very strenuous exercise. …
- Installing React on an existing site
- Thinking about a design in terms of components
- Creating fully-featured function components using Hooks
- Storing and retrieving data from an external RESTful API
- Employing third-party components for CSS animation
- Using conditional rendering
Skill Level Intermediate
Essentials of CSS for React Developerswith Eric Greene53m 31s Beginner
React.js Essential Training (2018)with Eve Porcello1h 25m Intermediate
Using the exercise files1m 2s
1. Introducing React
2. First Project: Customizer
3. Second Project: Directory Browser
4. Third Project: Status Updater
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.