'use strict'
import Title from './App'
import React from 'react'
import { render } from 'react-dom'
render(
React.createElement(Title),
document.querySelector('[data-js="app"]')
)
第3行出现错误
行:
import Title from './App'
错误:
Uncaught SyntaxError: Unexpected identifier in bundle.js:48
App.js
'use strict'
import React from 'react'
var Title = React.createClass({
render: function () {
return React.createElement('h1', null, 'Título')
}
})
export default Title
括号显示此错误:
Expected an identifier and instead saw 'import'.import Title from './App'
ESLint (1): ERROR: Parsing error: The keyword 'import' is reserved import Title from './App'