我假設包react-virtual-list在使用VirtualList
時調用setState
,但這不應該導致componentDidMount
內部的問題吧?爲什麼在ComponentDidMount中調用setState會導致錯誤?
Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the vlist component.
componentDidMount =() => { this.MyVirtualList = VirtualList({container: this._itemsList})(this.MyList) }
你能發佈組成你的組件的代碼嗎? – djfdev
什麼是'''this.MyVirtualList'''?這是一個功能?請展示更多代碼。 –