Skip to content

Commit 352c3ff

Browse files
authored
Fix example
1 parent 877b189 commit 352c3ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/docs/hooks-faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ Yes. See [conditionally firing an effect](/docs/hooks-reference.html#conditional
467467
Generally speaking, no.
468468

469469
```js{3,8}
470-
function Example() {
470+
function Example({ someProp }) {
471471
function doSomething() {
472472
console.log(someProp);
473473
}
@@ -481,7 +481,7 @@ function Example() {
481481
It's difficult to remember which props or state are used by functions outside of the effect. This is why **usually you'll want to declare functions needed by an effect *inside* of it.** Then it's easy to see what values from the component scope that effect depends on:
482482

483483
```js{4,8}
484-
function Example() {
484+
function Example({ someProp }) {
485485
useEffect(() => {
486486
function doSomething() {
487487
console.log(someProp);

0 commit comments

Comments
 (0)