You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/useCallback.mdx
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,8 @@ The following example will form the basis of the explanations and code snippets
23
23
24
24
<EditornoInlinecode={Starter} />
25
25
26
-
In the example above, the parent component, `<Age />` is updated (and re-rendered) whenever the "Get older" button is clicked.
27
-
Consequently, the `<Instructions />` child component is also re-rendered because the `doSomething` prop is passed a
26
+
In the example above, the parent component, `<App />` is updated (and re-rendered) whenever the "Get older" button is clicked.
27
+
Consequently, `<Age />` and `<Instructions />` child components are also re-rendered. `<Instructions />` is re-rendered because the `doSomething` prop is passed a
28
28
new callback, with a new reference. This can be seen from the random text colour which changes whenever the state value `age` is updated.
29
29
30
30
> NB: Even though the `Instructions` child component uses `React.memo` to optimize performance, it is still re-rendered.
0 commit comments