如果我从我的应用程序的模块级别调用Redux.createStore(),它将导致引擎抛出
index.jsx?4657:77 Uncaught TypeError: (0 , _redux.createStore)(...) is not a function
通过反复试验,我发现如果我在一个函数中调用它,一切都很好。例如:
(function() {
const store = createStore(reducer)
...
)()
任何人都可以解释为什么会这样吗?实际上,http://redux.js.org/docs/basics/Store.html中的示例在模块级调用createStore()。这是其他开发者需要了解的隐藏问题吗?或者这可能是我的webpack配置或其他地方的一些funkiness的结果?