簡體   English   中英

HashRouter在反應路由器4.x中提示錯誤

[英]HashRouter tips error in react router 4.x

Web Tips圖片旁邊

https://i.stack.imgur.com/A2OGn.png

Warning: Hash history cannot PUSH the same path; a new entry will not be added to the history stack

提示錯誤,這是我再次點擊鏈接的時候


圖片旁邊是React-Router文件代碼......

https://i.stack.imgur.com/WgqqN.png

import { HashRouter, Route } from 'react-router-dom';

import { Provider } from  'react-redux';
import View from './containers';
import configureStore from './store/configureStore';

const store = configureStore();

const AppRouter = () => (
    <Provider store={store}>
        <HashRouter>
            <View.App.Container>
                <Route path='/' exact={true} component={View.App.Dashboard} />
                <Route path='/Todo' component={View.Todo.Container} />
                <Route path='/News' render={() => (
                    <View.News.Container>
                        <Route path='/News/List' render={() => (
                            <h2>News List Show</h2>
                            )} />
                    </View.News.Container>
                )} />
            </View.App.Container>
        </HashRouter>
    </Provider>
);

export default AppRouter;

如果使用組件鏈接進行導航,則可能需要在其上設置prop replace

https://reacttraining.com/react-router/web/api/Link/replace-bool

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM