React router v4 - How do you access the state that is passed via Redirect?

前端 未结 2 1762
既然无缘
既然无缘 2021-02-14 04:27

I am making a login page with the help of react that redirects to another page when the login is successful. Let me call the component that gets rendered when the login is succe

相关标签:
2条回答
  • 2021-02-14 04:43

    you can access state using this.props.location.state

    0 讨论(0)
  • 2021-02-14 04:45

    You can use the location prop to access the state you have passed. Visit React-Router for reference. When you want to access that state, you can do it by this.props.location.state.

    0 讨论(0)
提交回复
热议问题