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

Gennadii Chamorsov
Gennadii Chamorsov
9,207 Points

Is there anything like match object and use of it in React Router Dom v6?

I am trying to follow up the course with React Router Dom version 6 installed and it gets pretty confusing. Is there still a use of an older version in a real world?

1 Answer

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hi Gennadii Chamorsov,

Great question! Have you checked out the React Router v6 documentation yet? You'll be able to find all changes there along with some great examples.

As for a match alternative it depends on what you want to do with this object. There are a couple of hooks like useParams which you can use to retrieve the query parameters.

When following along with this video I'd suggest to stick to React Router v5.3.0 as mentioned in the Teachers Notes, this was the latest stable release before they recently updated to v6. As the update was quite recently this is currently still being used in the real world, also v6 no longer works with Class based components.

Hope this helps 🙂