The react jump routing page is blank because of a writing error. The solution is: 1. Determine the link that needs to be implemented on the page; 2. Modify the code to "this.props.history.push({pathname:`/cardetails `,search:`?productId=${car.productId}`,state:car,})”.
The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.
What should I do if the react jump routing page is blank?
react When routing parameter jumps, the page is blank
//页面需要实现的链接是这样的,http://localhost:4500/cardetails?productId=12676 //会导致空白的错误写法是 this.props.history.push({ pathname:`/cardetails?productId=${car.productId}`, state:car, }) //正确写法是下面 this.props.history.push({ pathname:`/cardetails`, search:`?productId=${car.productId}`, state:car, }) //以上是个人开发中遇到的问题,仅供参考~~
The wrong way to write it is that after the click event, the page link has changed, but the page content is blank and no error is reported. Need to Manually refresh the page to see the content. After the
writing method is changed, the routing information can be accurately located and the problem can be solved.
Recommended learning: "react video tutorial"
The above is the detailed content of What to do if react jump routing page is blank. For more information, please follow other related articles on the PHP Chinese website!