“ReferenceError:未定义ReactRedux

时间:2017-06-24 16:07:23

标签: javascript

我正在关注Redux教程并试图包含Provider。我正在使用JSbin

我的HTML:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <script scr="https://cdnjs.cloudflare.com/ajax/libs/react-redux/5.0.5/react-redux.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.js"></script>
  <script src="https://wzrd.in/standalone/expect@latest"></script>
  <script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
  <title>JS Bin</title>
  <script src="https://fb/react-0.14.3.js"></script>
  <script src="https://fb/react-dom-0.14.3.js"></script>

</head>
<body>
  <div id='root'></div>
</body>
</html>

JS文件:

const { Provider } = ReactRedux;

但是我收到了错误:

"ReferenceError: ReactRedux is not defined

我做错了什么?

1 个答案:

答案 0 :(得分:1)

在您发布的代码段中,您有 scr 而不是 src

<script scr="https://cdnjs.cloudflare.com/ajax/libs/react-redux/5.0.5/react-redux.js"></script>

应该是

<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/5.0.5/react-redux.js"></script>