[Solved] React hooks functional component solution: Can’t perform a React state update on an unmounted component

const [value, setValue] = useState('');
//....

useEffect(() => {<!-- -->
fetchValue().then(() => {<!-- -->
     setValue("fetch_done!"); //  triggers react memory leak
   });
}, []);

Workaround

useEffect(() => {<!-- -->
fetchValue().then(() => {<!-- -->
     setValue("done!"); //  triggers react memory leak
     //add
   });
   return ()=>setValue('') //Return the problem setstate to the default value
}, []);

Lifecycle

useEffect(() => {<!-- -->
//componentsDidMount
return ()=>{<!-- -->
// componentsWillUnmount
}
}, []); ```