ReactDOM.render出语法错误
发布于 8 年前 作者 ystyle 10473 次浏览 来自 问答
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore } from 'redux'
import { Provider } from 'react-redux';
import App from './containers/App';
import todoApp from './Reducers/Reducers';

let store = createStore(todoApp);
let app = document.getElementById('app');
ReactDOM.render(
  <Provider store={store}>
    <App />
  </Provider>,
  app
);

这代码为什么是语法错误? 傲游截图20160531003417.png

2 回复
npm install babel-loader babel-core babel-preset-es2015 babel-preset-react --save-dev

module: {
    loaders: [
        {
            test: /\.(jsx|js)$/,
            loader: 'babel-loader',
            exclude: /node_modules/,
            query: {
                presets: ['react', 'es2015']
            }
        }
    ]
},

@yuyang041060120 谢谢, 我的.babelrc 没拷贝过来…

回到顶部