文章詳情頁
javascript - react-router-dom 跳轉(zhuǎn)問題js
瀏覽:201日期:2023-08-30 10:20:43
問題描述
設(shè)置內(nèi)容如下:
<Route path='/first' component={First} /> <Route path='/first/:id' component={FirstDetail} />
問題是:在first頁面跳轉(zhuǎn)到first:/id頁面,不會刷新頁面,會追加內(nèi)容。請問有什么好的方法?,這兩個路由對應(yīng)的是不同的頁面
問題解答
回答1:import {Switch} from ’react-router-dom’;....<Switch> <Route path='/first' exact component={First} /> <Route path='/first/:id' component={FirstDetail} /></Switch>
標(biāo)簽:
JavaScript
相關(guān)文章:
1. javascript - immutable配合react提升性能?2. javascript - sublime快鍵鍵問題3. 配置Apache時,添加對PHP的支持時語法錯誤4. Apache 已經(jīng)把網(wǎng)站根目錄的改為allow from all了,但是服務(wù)器還是不能訪問?5. css - 寫頁面遇到個布局問題,求大佬們幫解答,在線等,急!~6. phpstudy8.1支持win11系統(tǒng)嗎?7. javascript - nodejs關(guān)于進(jìn)程間發(fā)送句柄的一點(diǎn)疑問8. 實(shí)現(xiàn)bing搜索工具urlAPI提交9. vue.js - Vue 如何像Angular.js watch 一樣監(jiān)聽數(shù)據(jù)變化10. javascript - 移動端上不能實(shí)現(xiàn)拖拽布局嗎?
排行榜

熱門標(biāo)簽
網(wǎng)公網(wǎng)安備