Somewhere in component 1, I have this:
if (redirectToReferrer) {
return <Redirect to={{
pathname: "/test/new",
state: { event: "test" }
}} />;
}
In my component 2, I have this:
constructor(props){
super(props);
console.log(this.props.location) //undefined
}
According to the docs, this should work.
The state object can be accessed via this.props.location.state in the redirected-to component. This new referrer key (which is not a special name) would then be accessed via this.props.location.state.referrer in the Login component pointed to by the pathname '/login'
Why is this.props.location
undefined?