From the course: React: Advanced Code Challenges

Unlock this course with a free trial

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

Overcoming the props drilling pitfall

Overcoming the props drilling pitfall - React.js Tutorial

From the course: React: Advanced Code Challenges

Overcoming the props drilling pitfall

- [Instructor] React makes it easy to pass data from one component to another using the props. But when your components tree grows deep and bigger, you often end up with what we call props drilling. So how do we overcome the props drilling pitfall? Props drilling is the process of passing data down through multiple layers of components in the application tree. So in order to reach one deeply nested child component, you need to go through multiple layers of components that don't actually use the data. And as the application grows, this may lead to hard to maintain, cluttered, tightly coupled components that are hard to maintain and update. So let's look at one code example. In this application, we want to display the user information. In order to do that, we need to go through multiple layers of components in the application tree, starting from the parent components, line 15, then going through the child components, line 20, and finally all the way to the grandchild components, line…

Contents