Hashrouter refresh error, this.props.location.state is undefined

I jump from page A to page B with parameters

this.props.history.push({ pathname: "/send_msg", state: { query: obj } })

you can get this.props.location.state
clipboard.png

Bthis.props.location.stateundefined

clipboard.png

on the B page at this time.
May.20,2022

refresh will definitely report an error, because your parameters were brought from the previous page. The correct way is to use routing parameters, which can be placed in query. If the parameters are saved in url, you are not afraid to refresh the


this hashrouter pit, and you need to convert historyRouter.
reference: https://stackoverflow.com/que...

Menu