how do i redirect the reaction if the prop is not defined?

In your example, it isn’t saying that myData is undefined, it’s saying that it can’t read the property myData of undefined. I.e the state property of location is undefined.

componentDidMount() {
  if (this.props.location.state === undefined) {
  // else

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top