Browse Source

Fix typo

lukechilds-patch-1
Luke Childs 2 years ago
committed by GitHub
parent
commit
d08759fef5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/content/reference/react/useCallback.md

2
src/content/reference/react/useCallback.md

@ -155,7 +155,7 @@ function ProductPage({ productId, referrer, theme }) {
} }
``` ```
**By wrapping `handleSubmit` in `useCallback`, you ensure that it's the *same* function between the re-renders** (until dependencies change). You don't *have to* wrap a function in `useCallback` unless you do it for some specific reason. In this example, the reason is that you pass it to a component wrapped in [`memo`,](/reference/react/memo) and this lets it skip re-rendering. There other reasons you might need `useCallback` which are described further on this page. **By wrapping `handleSubmit` in `useCallback`, you ensure that it's the *same* function between the re-renders** (until dependencies change). You don't *have to* wrap a function in `useCallback` unless you do it for some specific reason. In this example, the reason is that you pass it to a component wrapped in [`memo`,](/reference/react/memo) and this lets it skip re-rendering. There are other reasons you might need `useCallback` which are described further on this page.
<Note> <Note>

Loading…
Cancel
Save