Iが反応/ Reduxのチュートリアルのカップルに次のコードを見てきた:次のReduxパラダイムの背後にある理由は何ですか?
componentWillUnmount() {
this.unsubscribe();
}
componentDidMount() {
this.unsubscribe = this.context.store.subscribe(() => {
this.forceUpdate();
});
}
このコードの目的は何ですか?コンポーネントがアンマウントされたときに、このコードはストアが変更されるたびにforceUpdate
を呼び出しませんか?なぜ我々はそれを望むだろうか?