I have the following URL:
http://my.site/?code=74e30ef2-109c-4b75-b8d6-89bdce1aa860
And I want to redirect to:
http://my.site#/homepage
I do that with:
import { push } from 'react-router-redux'
...
dispatch(push('/homepage'))
But react takes me to:
http://my.site/?code=74e30ef2-109c-4b75-b8d6-89bdce1aa860#/homepage
How can I tell React to drop the query param in the browser's address bar without reloading the application?
With Regular Expression maybe this solution is easier for you:
var oldURL = 'http://my.site/?code=74e30ef2-109c-4b75-b8d6-89bdce1aa860'
var newURL = /(http(s?).+)(\?.+)/.exec(oldDomain)[1] + 'homepage'
You can use newURL in your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With