In my React app, I do conditional logic on a route Component’s initialization/rendering based on where the user came from. If he came from Page A, then the Link to the page holds state data that is read from this.props.location.state
when the route is rendered. But on refresh, I need the page to “forget” where the user came from (or more specifically, clear location.state
).
Unfortunately, Reach Router doesn’t use history
as a dependency, so it seems solutions like these which advocate for history.update()
won’t work.