score:13

The way you are passing your state to the Redirect is correct, the only place the problem should be is how you are accessing it. State can be accessed like this.props.location.state. However if you directly route to the path then state won't we available so you need to add a check

Access your state like

 this.props.location.state && this.props.location.state.referrer

Related Query

More Query from same tag