6. Transferring Properties (Props)

There is a frustrating side to working with properties. We kinda saw this side in the previous chapter. Passing properties from one component to another is nice and simple when you are dealing with only one layer of components. When you wish to send a property across multiple layers of components, things start getting complicated.

Things getting complicated is never a good thing, so in this chapter, let’s see what we can do to make working with properties across multiple layers of components easy.

Problem Overview

Let’s say that you have a deeply nested component, and its hierarchy (modeled as awesomely colored circles) looks like Figure 6-1.

Figure 6-1 The component hierarchy.

What you want to do is pass ...

Get Learning React now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.