What's the different between browserHistory.push() and location.replace()

browser-history, location

Solution

History Push The user can go forward and backward in the browser and the url will change. It works like a programmatic link with no affect on current url.

Location Replace The link of the page is set to the new one, but the user can't go between the replaced.

Hope this will help you ;)

Problem

I build my project with react, when I want to change the URL I find both browserHistory.push(myUrl) and location.replace() are worked. So I want to know what's the different between them. ``` divClick() { location.replace('/doctor/task'); // browserHistory.push('/doctor/task'); } render() { return ( <div> <div onClick={this.divClick.bind(this)}>Change</div> </div> ); } ```

Original source