Skip to content

Commit

Permalink
Clarify when cleanup effect runs with [] deps
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiebits committed Nov 2, 2018
1 parent 145debb commit bd1d483
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/docs/hooks-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ useEffect(

Now the subscription will only be recreated when `props.source` changes.

Passing in an empty array `[]` of inputs tells React that your effect doesn't depend on any values from the component, so that effect would run only on mount and unmount, never on updates.
Passing in an empty array `[]` of inputs tells React that your effect doesn't depend on any values from the component, so that effect would run only on mount and clean up on unmount; it won't run on updates.

> Note
>
Expand Down

0 comments on commit bd1d483

Please sign in to comment.