React-dnd教程 - ES5和ES2015版本都抛出了Game.observe不是一个功能'

时间:2015-11-08 14:24:00

标签: javascript reactjs

这里有什么问题?

'未捕获的TypeError:(0,_Game.observe)不是函数'

  

Game.jsx

export function observe(receive) {
    setInterval(() => receive([
        Math.floor(Math.random() * 8),
        Math.floor(Math.random() * 8)
    ]), 500);
};
  

index.jsx

import React from 'react';
import ReactDOM from 'react-dom';
import Board from './Board';
import { observe } from './Game';

const rootEl = document.getElementById('root');

observe(knightPosition => 
    ReactDOM.render(
        <Board knightPosition={knightPosition} />,
        rootEl
    )
);

0 个答案:

没有答案