Stack OverflowMediumdev.toGitHub
React

React

✍️ Published on ( min read)

Hooks

  • UseEffect runs everytime the app renders, second parameter determines when it renders, for eg useEffect(()=>{}, []) runs on first load, second paramenter can be a state and useeffect will run when the state updates.
  • setState will not update the state automatically, so better to have a useEffect that will do stuff when it updates.
  • window.localstorage won't be available until the app renders on the client side.