Prop drilling can be a pain, but it does have its upsides. Find out why prop drilling is useful in this tutorial.

Introduction to prop drilling

There has always been a need to share data with different components when working with React. This can be achieved in the most basic way using prop drilling. Prop drilling allows for unidirectional data sharing between components. The data passed or shared in the form of props.

Let’s consider the diagram below:

A diagram explaining how props drilling works.

For the data in the A component to be accessed in the C component, it has to be passed down as prop to the B component, and then finally the C component. This is known as threading.

From the above explanation, you can understand the basics of what prop drilling is and why we need it.

Now let’s go ahead and create a simple application using what we learned above. All the code for this tutorial can be found here.



#react #reactjs #javascript #web-development #developer

The Upsides of Prop Drilling in React
2.90 GEEK