I believe it was mentioned above by Dennis Nerush, you need to use {browserHistory} instead of {hashHistory}, however for the same page rendering to work you need to configure your server a bit to allow for this.
Depending on where you are hosted or what server you are using there are a few ways to do this
For Apache you must add the following to the .htaccess (or create .htaccess and place it in the root folder of your website):
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
For Node.js/ Express you need to add the following code:
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, 'path/to/your/index.html'), function(err) {
if (err) {
res.status(500).send(err)
}
})
})
for Nginx servers you need to add the following to the Nginx.conf file
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.html break;
}
}
For Amplify you need to go to Rewrites & Redirects and add a new rule that with the following information (Note I have only used this on AWS):
Source address: </^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$)([^.]+$)/>
Target address: /index.html
Type: 200
Here are a few links if you want to do some more research on the subject.
https://www.andreasreiterer.at/fix-browserrouter-on-apache/#comment-186 (Specifically for Apache)
https://ui.dev/react-router-cannot-get-url-refresh/ (Multiple methods for different servers or no server which I did not add above)
React Router DOM not working correctly on Amplify Console AWS (Use this one for AWS and Amplify)