mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 20:01:57 +00:00
Update useCallback.md - rename ShoppingForm to ShippingForm (#5656)
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user