错误(无法获取未定义的属性"subscribe")在 react-redux trySubscribe with Internet Explorer



My 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()
        }
      }

所以这个存储似乎是未定义的,但我不知道为什么?

找到了!

我使用了一个容器组件来扩展另一个容器部件,它们都用@connect装饰!

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

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

最新更新