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 4 Basics Going Further with Routing Using URL Parameters

blake guyan
blake guyan
8,297 Points

URL parameters not working, has REACT changed?

So I am doing the REACT course and this lesson is set up so that if there is a subURL to teachers that it will populate the page using the "featured.js" jsx data. however dispite the fact that if i mess up the syntax on "featured.js" i get an error it is somehow still showing the teachers page.. i am most confused...

2 Answers

Thomas Dimnet
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Thomas Dimnet
Python Development Techdegree Graduate 43,610 Points

Hi Blake,

do you have maybe a piece of code you can show in order to understand what's going wrong with your code? I've just finished the course and I did not encounter any errors.

Thomas.

Jacob Silverman
seal-mask
.a{fill-rule:evenodd;}techdegree
Jacob Silverman
Full Stack JavaScript Techdegree Student 14,357 Points

Hi Blake, you may have made the same mistake as me.

Initially I used 'exactly' instead of 'exact' prop. This is the correct two lines:

<Route exact path="/teachers" component={Teachers} />
<Route path="/teachers" component={Featured} />