0

I'm using react router in my redux web app when i try to update the route using

this.props.history.push('/route')

It adds a ? to the address like so

https://website.com/?#/route

When it should look like this

https://website.com/#/route

This causes my single page application to reload.

Things i tried:

  • upgrading react router to latest (2.0.1, currently using 1.0.3) didn't help
  • we're using hash history, switching to browser history didn't help
JohnGill
  • 3
  • 2

2 Answers2

0

Try with this

import { Router, Route, BrowserHistory } from 'react-router';

let bHistory = BrowserHistory({
  queryKey: false
});

It will diable the random string appearing in the route path.

WitVault
  • 23,445
  • 19
  • 103
  • 133
0

Is it because you're using <form> with React, and it's submitting a form.

See this answer for a better explanation: https://stackoverflow.com/a/32570827/5498949

Community
  • 1
  • 1
Sledge Hammer
  • 231
  • 1
  • 2
  • 8