Search code examples
react-nativereact-hooksreact-native-navigationreact-domreact-async

Caught Error error while using useEffect react native HOOks


so i am trying to use async storage and trying to validate if their is data in Async or not.. here is my code here is the error

i am not able to validate through...


Solution

  • You should move calling the hook outside of your code

       const readData = ...
    
    
       useEffect(() => {
         const timeout = setTimeout(() => readData(), 5000)
         return () => { clearTimeout(timeout) }
       }, [])
    
    
    

    Next time post code questions with code.