【发布时间】:2015-05-18 21:18:18
【问题描述】:
这真的很愚蠢,但我在 Chrome 上遇到了问题(在 Firefox 中运行良好),这种语法是从 react-dnd 组件中的一个示例中借用的(链接:https://github.com/gaearon/react-dnd/blob/master/examples/_dustbin-simple/Dustbin.js)。
const itemDropTarget = {
acceptDrop(component, item) {
component.setItem(item);
}
};
它触发了这个错误:
Uncaught SyntaxError: Unexpected token (
Chrome 也不喜欢这样:
const DustbinSimple = React.createClass({
render() {
一定是:
const DustbinSimple = React.createClass({
render: function() {
我错过了什么?一定是非常基本的东西,我不明白。
提前致谢。
【问题讨论】:
标签: javascript reactjs syntax-error react-jsx