JavaScript React Basics (retired) Thinking in Components Decomposing our Application

Why do we need the title key on both the header and application components?

Same for the counter and player components. Would there be something wrong with adding just the score key to counter and the title key to header?

3,503 Points

Short answer is that the containing component is passing the title information to the component within.

I think it just boils down to how you want to structure your app. Personally, I like the the way it is in the video because it makes sense to give the title to the scoreboard when you instantiate the Application component. If the app grew to contain more than just a scoreboard I think giving the title straight to the header would make sense (or at least giving it a more specific property name like 'scoreboard-title').

I do think that in any case it makes more sense to keep the score with the Player component because that data is strongly related. I'm not even sure how you'd approach separating them out. You wouldn't want to have just the score free-floating somewhere else in the app.