老师,浏览器运行报"Cannot read property 'createElement' of undefined"错

来源:4-8 redux-react使用介绍(2)

起个洋气的名字

2018-11-06

图片描述
Index.js代码:

import {React} from 'react';
import ReactDom from 'react-dom';

import {Provider} from 'react-redux';
// import {Main} from './Main/Main.jsx';

import store from './store.js';

ReactDom.render(
    <Provider store={store}>
        {/*<Main/>*/}
        <div>1</div>
    </Provider>,
    document.getElementById('root')
);

我把Main组件注释掉之后只是一个div。
怎么解决

写回答

1回答

吕小鸣

2018-11-06

你好,这个是由于引入react不规范导致的,在es6的规范里,修改引入react为

import React from 'react';


0
1
起个洋气的名字
对,去掉大括号就好了,谢谢老师
2018-11-07
共1条回复

移动Web App开发之实战美团外卖

运用React全家桶技术,从0到1学习全面的移动 Web APP 开发技术。

389 学习 · 235 问题

查看课程