React JS Uncaught SyntaxError:embedded:意外的令牌

时间:2017-03-06 21:29:11

标签: html reactjs babel

新的反应和贯穿教程。 https://www.kirupa.com/react/creating_complex_components.htm

我收到错误" Uncaught SyntaxError:embedded:Unexpected token"在我的Card类的返回功能之后。我是网络开发的新手,我正在努力朝着正确的方向前进。我下载了针对chrome的react dev工具,但它永久地说等待root加载......

此错误通常来自语法错误,因此我认为我的代码有问题。任何帮助表示赞赏。

<!DOCTYPE html>
<html>

<head>
  <title>React! React! React!</title>
  <script src="https://unpkg.com/react@15.3.2/dist/react.js"></script>
  <script src="https://unpkg.com/react-dom@15.3.2/dist/react-dom.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>


  <style>
    #container {
      padding: 50px;
      background-color: #FFF;
    }
  </style>
</head>

<body>
  <div id="container"></div>
  <script type="text/babel">


  var Card = React.createClass({
    render: function() {
        var cardStyle = {
          height: 200,
          width: 150,
          padding: 0,
          backgroundColor: "#FFF",
          WebkitFilter: "drop-shadow(0px 0px 5px #666)",
          filter: "drop-shadow(0px 0px 5px #666)"
        };

        return (
          <div style={cardStyle}>

          </div>
        );
      }
  });

    ReactDOM.render(
      <div>
        <Card/>
      </div>,
      document.querySelector("#container")
    );
  </script>
</body>

</html>

0 个答案:

没有答案