मेरी घटक में मैं निम्नलिखित है: this
कोRedux का उपयोग करते समय प्रतिक्रिया घटक में सदस्यता समाप्त कैसे की जानी चाहिए?
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op.
क्या मैं जानना चाहते हैं है मैं unsubscribe
बताए किया जाना चाहिए या नहीं है:
componentWillMount: function() {
this.unsubscribe = store.subscribe(function() {
this.setState({message: store.getState().authentication.message});
}.bind(this));
},
componentWillUnmount: function() {
this.unsubscribe();
},
कॉल नहीं सदस्यता समाप्त निम्न त्रुटि का कारण बनता है इसे असाइन करने के लिए एक बेहतर जगह?
आपको घटक WillMount() के बजाय घटकडिडमाउंट() में प्रयास करना चाहिए। – legolandbridge
@legolandbridge जो कोई फर्क नहीं पड़ता क्योंकि मुझे अभी भी 'सदस्यता समाप्त करने की आवश्यकता है'। – Clarkie
क्या आपने 'रिएक्ट-रेडक्स' के 'कनेक्ट' और' प्रदाता 'का उपयोग करने में देखा है? –