How can I get working this path admin/users/:id
by using react-router-dom ??
I have no problem when the level is just one, I mean something like: /users/:id
Router:
class App extends Component {
render() {
return (
<Router>
<React.Fragment>
<Header />
<Container fluid={true} className="content">
<Switch>
<Route path="/dashboard" render={() => <h1>DashBoard</h1>} />
<Route path="/admin/users" component={AdminUsers} />
//Below line is not working as I expect.
<Route path="/admin/users/:id" render={() => <h1>User View</h1>} />
<Route path="/admin/clients" render={() => <h1>Admin Clients</h1>} />
<Route path="/reporting" component={AdminReportPage} />
<Route path="/help" render={() => <h1>Help</h1>} />
<Route render={() => <h1>Page not found.</h1>} />
</Switch>
</Container>
</React.Fragment>
</Router>
)
}
}
export default App;
when I try to go to admin/users/:id
the application doesn't respond and stay in admin/users
.
Extra: "react-router-dom": "4.3.1"
输入“ / admin / users”的确切属性,即:
<Route exact path="/admin/users" component={AdminUsers} />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.