search

Home  >  Q&A  >  body text

javascript - react-router-dom jump problem js

The settings are as follows:

<Route path="/first" component={First} />
            <Route path="/first/:id" component={FirstDetail} />

The problem is: when the first page jumps to the first:/id page, the page will not be refreshed and the content will be appended. Is there any good method? , these two routes correspond to different pages

某草草某草草2715 days ago818

reply all(1)I'll reply

  • 代言

    代言2017-06-22 11:56:24

    import {Switch} from 'react-router-dom';
    
    ....
    
    
    <Switch>
        <Route path="/first" exact component={First} />
        <Route path="/first/:id" component={FirstDetail} />
    </Switch>

    reply
    0
  • Cancelreply