Search code examples
urlhistoryreact-router

How can I follow a react-router Link without it being pushed to history, but keep URL change?


I want to change URL when clicking on component Links, same way they currently change by default, but without them being pushed to browser history. I've found the following working for someone in this answer:

this.props.activeRouteHandler({key: "anystring"})

but I don't know where should I place it and if it even works anymore. Can someone give me an example? Thanks


Solution

  • For version ^0.13.3 I had to create custom MyLink component same as Link but with replaced this.transitionTo to this.replaceWith.

    For version ^1.0.x API changed: var { History } = require('react-router') ... mixins: [ History ] ... this.history.pushState(null, '/newPathName')