From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Advanced scenario 1: Multiple dependents

Advanced scenario 1: Multiple dependents

Welcome back, in this video we are going to learn about the advanced scenario number one with lifting up the state which is multiple dependent components. Lifting the state up avoids inconsistent data as well as it also avoids duplication. We are going to learn this scenario and extract an input from this using an example. In this example, we are going to have a form input which is going to have a preview and a validation component which will be serving as a child component. That's how the example is going to look like. We are going to form a parent component which will have the state. The state in this example is going to be name. After that we are going to have three child components. The first component is going to be the name input component. First component is going to be the name input component. The first component is going to be the name input component, which is going to take the value as name and an onChange event of setName. As you can see, this component is going to update…

Contents