Answers for "how to setstate in useeffect"

0

how to setstate in useeffect

React.useEffect(() => {
  let didCancel = false;
 
  // ...
  // you can check didCancel
  // before running any setState
  // ...
 
  return () => {
    didCancel = true;
  };
});
Posted by: Guest on January-14-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language