Browse Source

Update useCallback.md - rename ShoppingForm to ShippingForm (#5656)

main
skyhawk14 2 years ago
committed by GitHub
parent
commit
657cd40016
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      beta/src/content/reference/react/useCallback.md

4
beta/src/content/reference/react/useCallback.md

@ -385,9 +385,9 @@ button[type="button"] {
#### Always re-rendering a component {/*always-re-rendering-a-component*/}
In this example, the `ShoppingForm` implementation is also **artificially slowed down** so that you can see what happens when some React component you're rendering is genuinely slow. Try incrementing the counter and toggling the theme.
In this example, the `ShippingForm` implementation is also **artificially slowed down** so that you can see what happens when some React component you're rendering is genuinely slow. Try incrementing the counter and toggling the theme.
Unlike in the previous example, toggling the theme is also slow now! This is because **there is no `useCallback` call in this version,** so `handleSubmit` is always a new function, and the slowed down `ShoppingForm` component can't skip re-rendering.
Unlike in the previous example, toggling the theme is also slow now! This is because **there is no `useCallback` call in this version,** so `handleSubmit` is always a new function, and the slowed down `ShippingForm` component can't skip re-rendering.
<Sandpack>

Loading…
Cancel
Save