React Router: hashHistory vs browserHistory

Joe Maddalone
InstructorJoe Maddalone

Share this video with your friends

Send Tweet

In this lesson we'll look at hashHistory which uses a hash hack to track our route changes vs browserHistory which delivers clean urls, but requires server work to implement

Jinto Jose
Jinto Jose
~ 5 years ago

Earler I used to do this.props.history.push() to navigate to a rote dynamically. Now, it throws error. How to do the same with context?

h2m2
h2m2
~ 5 years ago

disagree that an express application is a general case. in fact I doubt that react has prerequisites at all, certainly not node.js. disagree that const Home = () => <div><Links /></div>; goes without explanatory comments. It is not even worth a comment. So if all is clear and we know everything, why do we need this lecture at all?

h2m2
h2m2
~ 5 years ago

another example is this line: ReactDOM.render( <App />, document.getElementById( 'app' ) ); That being written, without further "note that ", we are all enlighted that we are now rendering Routes into the app.

Again, if everything is clear, why the course? I feel a little bit upset with the wealth on skill shared. Literally reading, what any third person types in: I do not need a course for that.

Joe Maddalone
Joe Maddaloneinstructor
~ 5 years ago

h2m2, this course does presume some familiarity with React. Sorry if that was not clear and thanks for pointing it out.

Regarding the two lines of code you mentioned requiring more explanation:

ReactDOM.render( <App />, document.getElementById( 'app' ) );
const Home = () => <div><Links /></div>

These common React usages are covered in courses like https://egghead.io/courses/react-fundamentals or https://egghead.io/courses/build-your-first-react-js-application

Cameron Fraser
Cameron Fraser
~ 4 years ago

To make browserHistory work without a server you can add historyApiFallback: true to your devServer block in your webpack.config.

it
it
~ 4 years ago

just so everyone is aware for this lesson use React-Router-Dom. This is the new version and works much much better.