Skip to content

Commit b28eb7e

Browse files
authored
Update useCallback example to clarify parent
Update paragraph to indicate that `<App />` is the parent.
1 parent 46e80f1 commit b28eb7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/docs/useCallback.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ The following example will form the basis of the explanations and code snippets
2323

2424
<Editor noInline code={Starter} />
2525

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
2828
new callback, with a new reference. This can be seen from the random text colour which changes whenever the state value `age` is updated.
2929

3030
> NB: Even though the `Instructions` child component uses `React.memo` to optimize performance, it is still re-rendered.

0 commit comments

Comments
 (0)