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 trialokilydokily
12,105 Pointsmatch.path and match.url both point to "/courses" so shouldn't isExact be true rather than false?
Maybe because of the redirect? But then why not display the full url? Actually after rewatch he explains in the video that the route url corresponds to the "courses" part of the url. Ok, but then why isn't isExact showing as true then?
2 Answers
Ben Slivinn
10,156 PointsisExact - (boolean) true if the entire URL was matched (no trailing characters)
path - (string) The path pattern used to match. Useful for building nested <Route>s
url - (string) The matched portion of the URL. Useful for building nested <Link>s
Make sure both path and url are the same, they actually may be not depending on how did you get to this url or where is your print function in the code.
What happens is that the Router doesnβt know the full path to the/courses so it routes you up until where it knows the way.
You can read more and see examples here
Cheers!
okilydokily
12,105 PointsThey are the same, we see this in the video.
Ben Slivinn
10,156 PointsIn simpler words:
If you inspect the courses component in React.tools, Now match contains information about how a route is matching the URL. For example the path property let's us know that courses uses the /courses path and the url property tells us that it's matching the courses portion of the url.
IsExect true if the entire path exactly the same, in the video the entire path is: /courses/html not/courses. (With nested routers)
path property of cources route component uses the 'parent' routing to /courses, and the url property is matching portion of the entire url, note: /cources is part of the entire url not all of it, so isExect will be false because the entire url is /courses/html.
If path was equal to /cources/html (like the entire path) then isExect was true .
okilydokily
12,105 Pointsokilydokily
12,105 PointsAnyways I believe that the issue is that match.url refers to the url produced in the browser bar and that isExact tells whether the url or the path match the browser bar.