This is my requirement.
When a route /xyz (displays xyz Component) is hit on browser, I need to navigate to separate route /abc (displays abc component).
I also need to pass new props and context to the target component on navigation.
I am looking for something like
**
<Redirect from="/xyz" to={{pathName: "/abc", component={<AbcComponent context={context} prop1={prop1} prop2={this.props.location.search}}}} />
**
How to achieve this in Reactjs ?
You can't use "component" key in "to" props of redirect
You can do this way to={{pathname="/abc",state={prop1=prop1,prop2=prop2} }}
<Redirect to={{pathName: "/abc", state={context:context,prop:prop1,prop2:props2} }} />
and
you can get data on /abc via props.location.state