Reactjs - 拖放(react-dnd)麻烦

时间:2017-05-08 04:36:36

标签: javascript reactjs drag-and-drop react-dnd

我有像这样编码的reactjs测试项目。

    import React, { Component, PropTypes } from 'react';
    import { DragDropContext } from 'react-dnd';
    import HTML5Backend from 'react-dnd-html5-backend';

    import Square from './Square';
    import Knight from './Knight';
    import { moveKnight } from './Game';
    import { canMoveKnight, moveKnight } from './Game';

    @DragDropContext(HTML5Backend)
.....

但是当我运行代码时,我得到了以下错误。

Failed to compile.

Error in ./src/Board.js
Syntax error: Unexpected token (11:0)

   9 | import { canMoveKnight, moveKnight } from './Game';
  10 | 
> 11 | @DragDropContext(HTML5Backend)
     | ^
  12 | 
  13 | export default class Board extends Component {
  14 |   static propTypes = {

 @ ./src/index.js 16:13-31

如果您对react-dnd和react-dnd-html5-backend有丰富的经验,请帮我解决这个问题。 感谢。

0 个答案:

没有答案