ReactJS useEffect, useState and useReducer
Closed this issue · 0 comments
8bitzz commented
useEffect()
- React synchronizes the DOM according to our current
props
andstate
. There is no distinction between a “mount” or an “update” when rendering. - This is subtly different from the familiar mount/update/unmount mental model.
useEffect
lets you synchronize things outside of the React tree according to our props and state- If you’re trying to write an effect that behaves differently depending on whether the component renders for the first time or not, you’re swimming against the tide!
Reference: https://overreacted.io/a-complete-guide-to-useeffect/