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 Getting Started with React Router Expand Your React Skills

Y B
Y B
14,136 Points

What version of React router are we using for this course?

The API for react router seems to have changed significantly for v4. As I would prefer not to learn a soon to be deprecated API does this course use v4? From a quick look it seem to be but doesn't use things list <BrowserHistory> and instead is using history= {hashHistory}. Have some things changed around this since the course was published?

1 Answer

Christian Tucker
PLUS
Christian Tucker
Courses Plus Student 1,987 Points

This course is currently using v2 of the react-router library. It's definitely outdated in terms of version, however there's not any breaking changes moving to v3. The v2 and v3 documentation is actually grouped together on the GitHub which I've linked to below.

This can be found in the package.json file in the project files downloadable from this lesson

"react-router": "^2.7.0"

You can view the documentation for the react-router api >> here <<

You will also see that browserHistory and hashHistory are both available. Here's an excerpt from the docs.

browserHistory

browserHistory uses the HTML5 History API when available, and falls back to full refreshes otherwise. browserHistory requires additional configuration on the server side to serve up URLs, but is the generally preferred solution for modern web pages.

hashHistory

hashHistory uses URL hashes, along with a query key to keep track of state. hashHistory requires no additional server configuration, but is generally less preferred than browserHistory.

Y B
Y B
14,136 Points

ok thanks for the confirming