File tree Expand file tree Collapse file tree 1 file changed +0
-1
lines changed
src/content/reference/react Expand file tree Collapse file tree 1 file changed +0
-1
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,6 @@ function ProductPage({ productId, referrer }) {
197
197
その違いはキャッシュできる*内容*です。
198
198
199
199
* **[` useMemo` ](/reference/react/useMemo) はあなたの関数の呼び出し*結果*をキャッシュします**。この例では、` product` が変更されない限り、` computeRequirements (product)` の呼び出し結果をキャッシュします。これにより、` ShippingForm` を不必要に再レンダーすることなく、` requirements` オブジェクトを下位に渡すことができます。必要に応じて、React はレンダー中にあなたが渡した関数を呼び出して結果を計算します。
200
-
201
200
* **` useCallback` は*関数自体*をキャッシュします**。` useMemo` とは異なり、あなたが提供する関数を呼び出しません。代わりに、あなたが提供した関数をキャッシュして、` productId` または ` referrer` が変更されない限り、` handleSubmit` *自体*が変更されないようにします。これにより、` ShippingForm` を不必要に再レンダーすることなく、` handleSubmit` 関数を下位に渡すことができます。ユーザーがフォームを送信するまであなたのコードは実行されません。
202
201
203
202
すでに [` useMemo` ](/reference/react/useMemo) に詳しい場合、` useCallback` を次のように考えると役立つかもしれません。
You can’t perform that action at this time.
0 commit comments