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 React Router 4 Basics Navigating, Nesting and Redirecting Routes Using the Match Object

Philip Kroupoderov
.a{fill-rule:evenodd;}techdegree seal-36
Philip Kroupoderov
Front End Web Development Techdegree Graduate 21,641 Points

We did not define those properties

Guil showed, that our Courses component was getting some objects assigned to its props, such as match, location, history. But we did not define those props in our Courses component, so is the Route component defining those new props (match, location, history) in the Courses component when it get's rendered??

1 Answer

Hi Phil- You are exactly correct. Many dependencies like react-router create their own custom props that we can tap into as developers and use, with props.match and props.history being perfect examples. Using the Chrome React extension to see what a given components props are is a great way to explore what information you are able to tap into from these third-party components. Note how in order for these props to get passed down to the Courses component automatically, you need to use the component={Courses} and not a render=. To use this with a render call we would need to pass the props to it manually with something like render= { props => <Courses match = props.match />}