文章詳情頁
javascript - react-router-dom 跳轉問題js
瀏覽:106日期:2023-08-30 10:20:43
問題描述
設置內容如下:
<Route path='/first' component={First} /> <Route path='/first/:id' component={FirstDetail} />
問題是:在first頁面跳轉到first:/id頁面,不會刷新頁面,會追加內容。請問有什么好的方法?,這兩個路由對應的是不同的頁面
問題解答
回答1:import {Switch} from ’react-router-dom’;....<Switch> <Route path='/first' exact component={First} /> <Route path='/first/:id' component={FirstDetail} /></Switch>
標簽:
JavaScript
相關文章:
1. javascript - 有適合開發手機端Html5網頁小游戲的前端框架嗎?2. python - pandas按照列A和列B分組,將列C求平均數,怎樣才能生成一個列A,B,C的dataframe3. html - eclipse 標簽錯誤4. javascript - axios請求回來的數據組件無法進行綁定渲染5. python - Pycharm的Debug用不了6. 安全性測試 - nodejs中如何防mySQL注入7. javascript - 關于apply()與call()的問題8. javascript - JS變量被清空9. python文檔怎么查看?10. python - pycharm 自動刪除行尾空格
排行榜
