2

我的 React 无法在 Internet Explorer 10 上加载(与 Chrome 和 FF 一起正常工作)。

我收到错误:

TypeError: Cannot get property "subscribe" of undefined 
at trySubscribe
at componentDidMount 
at notifyAll 
at close 
at closeAll 
at perform 
at perform 
at perform 
at m 
at close

(翻译)

trySubscribe 函数在 react-redux ( src/components/connect.js ) 中:

trySubscribe() {
        if (shouldSubscribe && !this.unsubscribe) {
          this.unsubscribe = this.store.subscribe(this.handleChange.bind(this))
          this.handleChange()
        }
      }

所以似乎 this.store 是未定义的,但我不知道为什么?

4

1 回答 1

2

找到了 !

我正在使用一个容器组件来扩展另一个容器组件,并且它们都用@connect!

所以我正在尝试@connect一个不属于组件树的组件!

从超类中删除@connect后,问题解决了!(实际上我完全删除了超类(不再使用)并直接扩展Component)。

于 2016-03-25T16:57:35.853 回答