我正在adminDashboard
中将app.js
的{{1}}组件加载到Route
中。现在基于URL在adminDashboard
中,我想呈现一些组件。但是,它没有加载任何组件。此外,Chrome控制台的“网络”标签上没有任何活动。
如果我在不使用Route的情况下渲染它们,则它们可以正常渲染。
app.js
class App extends Component {
render() {
let { error, success } = this.props;
const Admin = Authorization(['admin'])
return (
<div className='app'>
<AdminNavbar logout={this.props.logout}/>
<Switch>
<Route exact path='/admin/signin' render={(props) => {
return <AuthForm />
}}
/>
<Route exact path='/admin' component={Admin(AdminDashboard)} />
</Switch>
<Footer />
</div>
);
}
}
MyComponent组件
const MyDashboard = (props)=> ` this is dashboard`
管理控制台
class AdminDashboard extends Component{
render() {
return (
<div>
<div className='row'>
<div className='col-md-2'>
<NavBar />
</div>
<div className='col-md-10'>
< Commisions /> //working properly if i load it without route
<Switch>
<Route exact path='/admin/dashboard' component={MyDashboard} /> // not work
//some other route
</Switch>
</div>
</div>
</div>
)
}
}