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!
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
olu adesina23,007 Points
whats the purpose of this.props.children?
why cant we just place other components inside provider tags like we did before ?
Alan Brown20,443 Points
You can. The tutorial is showing you a technique that you'll want to use on more complex apps. It might be overkill on this example, but it does show you how HOCs work. The HOC is a decorator, this.props.children allows you to pass in whatever component that you want to have the additional functionality. Imagine we were able to pass in different apps to the Scoreboard context in different situations. A referee perhaps, or post game charts. Maybe a more appropriate example would have been a Theming HOC that could control colour schemes for you components..