【发布时间】:2020-08-02 14:52:25
【问题描述】:
我有一个配置文件组件,它进一步分为配置文件表单和配置文件角色。我已经为这些子组件制作了路线,但它们不起作用。以下是该组件的示例代码。
Profile.js
render();
{
const profile = {
padding: '30px',
};
return (
<div
className="col-md-12 col-sm-12 profile-container bg-gray"
style={profile}>
<h3 className="roboto paragraph color-black mgb-60">Profile</h3>
<Router>
<Switch>
<Route exact path="/" component={ProfileForm} />
<Route path="/profile-form" component={ProfileForm} />
<Route path="/profile-roles" component={ProfileRoles} />
</Switch>
</Router>
</div>
);
}
个人资料角色
render();
{
return (
<Router>
<Switch>
<Route exact path="/" component={RoleLists} />
<Route path="/list" component={RoleLists} />
<Route path="/create" component={CreateRole} />
</Switch>
</Router>
);
}
现在我只能看到启动 profile.js 的“h3”标签。路由(配置文件和角色)似乎都没有工作。请帮忙。
【问题讨论】:
标签: reactjs typescript react-native react-router