From the course: Web Components and Modularization: Practical Approaches

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Top-down principle

Top-down principle

From the course: Web Components and Modularization: Practical Approaches

Start my 1-month free trial

Top-down principle

- [Instructor] The top-down principle is rigid and should always be followed. It says, information flows in one direction from the top of the damn tree down into the branches and eventually leaves, no information ever flows the other way. The top-down principle means any data query or collection must be done sufficiently high up in the tree to allow all components relying on that data to have access to it. Consider our book carousel component. In the markup, this carousel displays five books side by side, and the user can use the left and right arrows to navigate to more books in either direction. Inside book carousel, we have the book list component, which shows the book card components, and now comes the question, based on the top-down principle, what component makes the query for the book data? Each book card, the book lists, or book carousel? To find the answer, we need to think about what information the different…

Contents