写的路由如果有加 exact 就表示精确匹配,
例如: 精确匹配下的 ‘/’ 加后缀是匹配不到的,只能有访问 ’/‘才能跳转
一般情况下首页是需要精确匹配的。
<Route path = '/' exact component={Index} />
重定向的两种方法,引入Redirect 后
return (
第二种,在 constructor 里面写
this.props.history.push("/xxx")
写的路由如果有加 exact 就表示精确匹配,
例如: 精确匹配下的 ‘/’ 加后缀是匹配不到的,只能有访问 ’/‘才能跳转
一般情况下首页是需要精确匹配的。
<Route path = '/' exact component={Index} />
重定向的两种方法,引入Redirect 后
return (
第二种,在 constructor 里面写
this.props.history.push("/xxx")