Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Redirect 使用React路由器v4正确重定向_Redirect_Reactjs_React Router - Fatal编程技术网

Redirect 使用React路由器v4正确重定向

Redirect 使用React路由器v4正确重定向,redirect,reactjs,react-router,Redirect,Reactjs,React Router,据我所知,在RRv4中有很多方法可以转换页面 链接 重定向 this.context.router 如果用户不正确地访问页面,则查找重定向。我目前正在使用this.context.router这感觉不对 我是否应该将逻辑从组件willmount移动到render,而不是调用transition to来呈现重定向,以支持其组合?推荐的方法是使用声明性组件。这一点从没有显示上下文使用的文档中可以明显看出,RRv4创建者(Jackson和Florence)提到,您应该能够仅使用提供的组件完成任务

据我所知,在RRv4中有很多方法可以转换页面

  • 链接
  • 重定向
  • this.context.router
如果用户不正确地访问页面,则查找重定向。我目前正在使用
this.context.router
这感觉不对


我是否应该将逻辑从
组件willmount
移动到render,而不是调用
transition to
来呈现
重定向
,以支持其组合?

推荐的方法是使用声明性组件。这一点从没有显示上下文使用的文档中可以明显看出,RRv4创建者(Jackson和Florence)提到,您应该能够仅使用提供的组件完成任务