React Router URLs (Learning React)

Quick question about React Router and urls from the book “Learning React”. When I code the demo, the urls that the router produces are shown below: . (Home ‘page’) (Packages ‘page’) (Contact ‘page’)
These are odd looking especially with the ‘#’ character.
My question is can we do better? (ie. can get get rid of the # and make the urls more friendly?)

You can set your history to use browserHistory. I think by default it uses hashHistory which includes the hash (#) in the url. Using the browser’s history API allows the URL to change without using the hash (and not causing the page to reload).

1 Like