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

前端 未结 2 1761
既然无缘
既然无缘 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: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.

提交回复
热议问题