Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未捕获错误:钩子调用无效。钩子只能在函数组件的主体内部调用_Javascript_Reactjs_Redux_React Redux - Fatal编程技术网

Javascript 未捕获错误:钩子调用无效。钩子只能在函数组件的主体内部调用

Javascript 未捕获错误:钩子调用无效。钩子只能在函数组件的主体内部调用,javascript,reactjs,redux,react-redux,Javascript,Reactjs,Redux,React Redux,我正试图用redux启动一个react项目,但我得到了 错误: Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: ---- 1. You might have mismatching versions of React and the r

我正试图用redux启动一个react项目,但我得到了

错误:

Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
----
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
组件中发生了上述错误: 在提供程序中(由应用程序创建) 在ErrorBoundary中(由应用程序创建) 应用程序内

Package.json

    "@babel/polyfill": "^7.11.5",
    "@babel/preset-env": "^7.10.3",
    "@babel/preset-react": "^7.10.1",
    "axios": "^0.20.0",
    "babel-core": "^7.0.0-0",
    "babel-jest": "^26.3.0",
    "babel-loader": "7.1.2",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-polyfill": "^6.26.0",
    "babel-preset-es2015": "6.24.1",
    "babel-register": "^6.26.0",
    "img-loader": "2.0.0",
    "jsdom": "10.1.0",
    "mocha": "3.3.0",
    "mocha-image-compiler": "1.0.0",
    "prop-types": "15.6.0",
    "react": "16.13.1",
    "react-dom": "16.2.0",
    "react-redux": "^7.2.1",
    "react-render-html": "^0.6.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "^3.4.3",
    ...
App.js

class App extends Component {
    render () {
        // console.log('This is app.js inside render');
        return (
            <ErrorBoundary>
                <Provider store={store}>
                    <Routes />
                </Provider>
            </ErrorBoundary>
        )
    }
}

export default App
类应用程序扩展组件{
渲染(){
//log('这是app.js inside render');
返回(
)
}
}
导出默认应用程序

请帮助

您能将react dom更新到高于16.8.0吗

很抱歉忘记了,它是在我的最后一篇文章中添加的,谢谢