How to use useEffect in React hook
Issue #669
Specify params as array [year, id]
, not object {year, id}
1 | const { year, id } = props |
Hooks effect
By default, it runs both after the first render and after every update.
This requirement is common enough that it is built into the useEffect Hook API. You can tell React to skip applying an effect if certain values haven’t changed between re-renders. To do so, pass an array as an optional second argument to useEffect:
1 | useEffect(() => { |
Updated at 2020-06-17 06:21:08