Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript React Router Basics Going Further with Routes Passing props to Routes

Lucas Santos
Lucas Santos
19,315 Points

Does this mean that when passing in Props to a Route you don't need to define what kind of prop it takes?

Normally when passing in Props to a component we would need to define it's structure with PropTypes then define it's type such as String, Array or Shape for the objects.


Greeting.propTypes = {
  name: React.PropTypes.string,

<Component name="Bob" />

Now when he passed in the props to Routes we did not need to define anything... does this work like getDefaultProps() ?

Christian Blume
Christian Blume
10,424 Points

Hey Lucas,

defining which props a Component will receive isn't mandatory. It is good style though and can prevent you from making mistakes.

So, to answer your question: No, you definitely don't need to specify which props CourseContainerwill receive.