From the course: React: Design Patterns (2021)
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Recursive components
From the course: React: Design Patterns (2021)
Recursive components
- [Instructor] All right, so the first functional pattern that we're going to take a look at is recursive components. So again, recursive components are components that refer to themselves inside the body of the component. I'll show you what I mean in just a second here, but first make sure that you have the starting state of the exercise files because it's different than what we had before. So let's get started creating a recursive component, but before we do that, I want you to take a look at the app dot JS file. So notice here that we have this nested object here, and basically it's just an object where some of the properties, like a and b are themselves objects with other properties and those properties might be objects themselves with other properties, okay? So it's a pretty nested structure here. It could go a lot deeper if we wanted it to, but this kind of data, when we're working with nested objects or other…