reactjs - 反应路由器无法使用路径参数导航
问题描述
我在使用路径参数导航反应路由器时遇到问题
这是我的设置
render() {
return (
<Switch>
<Route path={Routes.PASSWORD_RECOVERY} component={ForgotPasswordView}/>
<Route path={Routes.VERIFY_EMAIL} component={VerifyEmailView}/>
<Route path={Routes.LOGIN} component={LoginView}/>
<Route path={Routes.SIGN_UP} component={SignUpView}/>
<Route path={Routes.VERIFY_RESULTS} component={VerifyGames}/>
<Route path={Routes.HOME} component={Home}/>
<Route path={Routes.WELCOME} component={Welcome}/>
<Route exact path={Routes.DEFAULT} component={DefaultHome}/>
<Route component={DefaultHome}/>
</Switch>
);
}
这是我的路线
static readonly SIGN_UP = "/signup";
static readonly LOGIN = "/login";
static readonly PASSWORD_RECOVERY = "/password_recovery";
static readonly VERIFY_EMAIL = "/verify_email";
static readonly HOME = "/home";
static readonly WELCOME = "/welcome";
static readonly VERIFY_RESULTS = "/verifier";
static readonly DEFAULT = "/";
现在,我希望能够导航到路径路径上的验证游戏组件/verifier
。
如果我导航到/verifier
它可以工作,但如果我附加路径参数它不会导航。
所以,/verifer
工作,但/verifier?name=mekings&&age=25
失败并总是重新路由回 DefaultHome 组件
为什么?
解决方案
推荐阅读
- android - 在 Kotlin 中忽略 ListPreference 更改
- pytorch - ret = torch._C._nn.nll_loss2d 中的错误(输入,目标,权重,_Reduction.get_enum(reduction),ignore_index)
- c - 计算 valgrind 错误而不报告它们
- jquery - 未捕获的类型错误:$(...).sidebar 不是函数
- php - 获取列的表名/实体
- pytorch - 在表格数据上创建 fastai 模型后如何对新数据进行评分?
- vue.js - Vuejs如何以这样的方式将一个数组分配给另一个数组,使得两个数组对更改没有反应
- javascript - Javascript 使用变量值作为父对象名称
- android - react-native apk 无法安装在麒麟芯片中
- python - 如何更改图像并适合标签内?