Check out a free preview of the full Vue 2 Internal Features from the Ground Up course

The "Challenge 8: Solution" Lesson is part of the full, Vue 2 Internal Features from the Ground Up course featured in this preview video. Here's what you'd learn in this lesson:

Evan walks through the solution to Challenge 8.

Preview
Close

Transcript from the "Challenge 8: Solution" Lesson

[00:00:00]
>> Evan You: We have our app, and this one should be very straightforward. So we can just create an inline component counter, the and expectation is it should just render the count inside a div in order to pass the test
>> Evan You: And obviously it should take a count prompt.
>> Evan You: That's it, and then this count, the real piece of state, this count, should live in our root component.

[00:00:39]
So,
>> Evan You: You can see that the counter itself simply takes some props and renders it, and the source of truth is in the common parent of all these instances. And so this is the most basic form of stage management in a lot of cases, but like in the worst case scenario you can have all your state in your root component and just keep passing them down with your props, right?

[00:01:12]
But you can quickly see how this pattern breaks down when your component tree structure becomes larger and larger and it's just completely infeasible to keep passing props over and over again.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now