Where's hashHistory in React Router v4?

前端 未结 1 1580
梦如初夏
梦如初夏 2021-02-04 06:15

I\'m trying to use a router for my React application. I tried something I\'d been using a while back, but can\'t seem to get it going. Has hashHistory been removed

1条回答
  •  臣服心动
    2021-02-04 06:44

    Use a HashRouter. They got rid of individual histories such as browserHistory and hashHistory and instead replaced them with BrowserRouter and HashRouter components respectively in React Router v4:

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

    Note that HashRouter comes from react-router-dom, not the core react-router package.

    0 讨论(0)
提交回复
热议问题