Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Is it good practice to put parents at the bottom of the code, rather than the top? It seems harder to visualise the app.

I've really enjoyed this course, but I'm wondering if it is standard/good practice to put parents at the bottom of the code, rather than at the top?

In these videos, Header comes first, then Player, then Counter, (Header, then Player > Counter) and THEN App (which is the parent of the other three), and this seems confusing and makes it hard to visually picture which component is the parent of another.

To me, it would make most sense to put the wrapper parent at the top (App), followed by Header, followed by Player, followed by Counter. This way, it's easier to see that the App component is the parent of the others.

I tried re-ordering the components to what I describe above, and the code still works, so it got me wondering... What is good practice in terms of how you lay out components in your React app code?

Is it standard practice to work 'outwards' like in the videos (starting with children, then wrapping at the end), or 'inwards' starting with the wrapper, and then following with the children?