Skip to content

Instantly share code, notes, and snippets.

@Oleg-Sulzhenko
Created September 13, 2019 07:51
Show Gist options
  • Save Oleg-Sulzhenko/c67bcf64ff1226ab073b0665bcf0984c to your computer and use it in GitHub Desktop.
Save Oleg-Sulzhenko/c67bcf64ff1226ab073b0665bcf0984c to your computer and use it in GitHub Desktop.
By using the second argument of the Effect Hook with care, you can decide whether it runs:
every time (no argument)
only on mount and unmount ([] argument)
only when a certain variable changes (e.g. [count] argument)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment