問題タブ [react-usememo]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
reactjs - useCallback と useMemo を正しく使用して再レンダリングを最小限に抑える
フックを使用して次の関数を作成し、次のようuseCallback
にに渡してinput
います。
次の質問があります。
event
依存配列にandを含める必要がありdata
ますか? これらは関数への入力であるため、inputChangeFunc
これらの値が変更されたときに再作成する必要はありません。intl.formatMessage
呼び出しをerror
aでラップして、再useMemo
レンダリングがトリガーされないようにする必要があります-次のようなものです:
またはこれは不要でしょうか?