Usage: To route for only one component in the Switch tag.
import { Router, Route, Switch } from 'react-router-dom'; ... <Router history={history}> <div> <Header /> <Switch> <Route path="/" exact component={StreamList} /> <Route path="/streams/new" exact component={StreamCreate} /> <Route path="/streams/edit/:id" exact component={StreamEdit} /> <Route path="/streams/delete/:id" exact component={StreamDelete} /> <Route path="/streams/:id" exact component={StreamShow} /> </Switch> </div> </Router>
沒有留言:
張貼留言