Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite下报错 #102

Closed
pincman opened this issue Apr 6, 2021 · 4 comments
Closed

Vite下报错 #102

pincman opened this issue Apr 6, 2021 · 4 comments

Comments

@pincman
Copy link

pincman commented Apr 6, 2021

代码

import { BasicLayout } from './layouts';
import Dashboard from './pages/dashboard/welcome';

const App = () => (
    <Router>
        <CacheSwitch>
            <CacheRoute exact path="/" component={BasicLayout} />
            <Route exact path="/p" component={Dashboard} />
            <Route render={() => <div>404 Not Found</div>} />
        </CacheSwitch>
    </Router>
);

export default App;

报错index.js:176 Uncaught ReferenceError: useHistory is not defined

@pincman pincman changed the title useHistory错误 Vite下报错 Apr 6, 2021
@CJY0208
Copy link
Owner

CJY0208 commented Apr 6, 2021

react-router-dom 的版本是多少?

@pincman
Copy link
Author

pincman commented Apr 6, 2021

@CJY0208 5.2.0

@CJY0208
Copy link
Owner

CJY0208 commented Apr 6, 2021

需要先检查一下业务代码中是否有未定义的 useHistory 方法,检查了代码,不像是 cache-route 内部的问题

可以尝试提供在线或者 github demo 来便于分析

@CJY0208
Copy link
Owner

CJY0208 commented Jul 13, 2021

无反馈,暂时关闭

@CJY0208 CJY0208 closed this as completed Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants