Answer the question
In order to leave comments, you need to log in
How to fix when adding any component to app.jsx, the context creation error that pops up?
Good time, there was a problem when adding components to the access point, such an error immediately pops up, how to fix it?
_react.default.createContext is not a function
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
import 'react-select/dist/react-select.css';
import configureStore from './Data/store/configureStore';
import Main from "./Templates/Main/Main";
const store = configureStore();
render(
<div>
<Provider store={store}>
<BrowserRouter>
<Main/>
</BrowserRouter>
</Provider>
</div>,
document.getElementById('app-root')
);
'use strict';
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'eval-source-map',
entry: [
'webpack-hot-middleware/client?reload=true',
path.join(__dirname, 'src/app.jsx')
],
resolve: {
root: [
path.resolve(__dirname, "src"),
],
extensions: ['', '.js', '.jsx', '.css']
},
output: {
path: path.join(__dirname, '/public/'),
filename: '[name].js',
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.tpl.html',
inject: 'body',
filename: 'index.html'
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}, {
test: /\.css$/,
loader: 'style!css'
}]
}
};
"react": "^15.6.2",
"react-addons-update": "^15.6.2",
"react-bootstrap": "^1.0.0-beta.5",
"react-dom": "^15.6.2",
"react-helmet": "^5.2.0",
"react-redux": "^6.0.0",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-select": "^1.0.0-beta13",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"sequelize": "^3.20.0",
"sqlite3": "^4.0.6"
Answer the question
In order to leave comments, you need to log in
_react.default.createContext is not a function
Google advises switching to version 16 of react, but I don't think this is a problem with the old version
"react-redux": "^6.0.0"
React Redux 6.x requires React 16.4 or later .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question