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.

Lifting state up: Recap

Lifting state up: Recap

Hello and welcome to lesson number two. In this lesson, we are going to learn the advanced scenarios for lifting the state up and we'll also recap it. This is important because before diving into advanced state management libraries, we should be aware what lifting the state up is and what are the advanced scenarios we can use it to. Let's start off with a quick recap. Lifting the state up involves moving the state to the closest common ancestor of components that actually need that state piece of value. This way we are going to avoid duplication of state in the siblings or the children components. Every component would be using a single source of truth in that case and one common state value which needs to be shared and used across multiple components can easily access that without having the risk of duplication. We use it with the help of passing on props. The direction of the props are that props are going to flow downwards but the events such as the setter functions are going to…

Contents