Elly
Elly

Reputation: 337

_reactNative.useState is not a function

hi everyone i'm just learning hooks in react native and i get an error when i try to execute the function written below. The code is:

    aa(){
      const [booblenavalue,setboolenavalue]=useState(false)
              useEffect(() => {             
              setboolenavalue(true)
            }, [])            
  }

My code don't work.My error is:" TypeError: (0 , _reactNative.useState) is not a function". How can I fix this error?

Upvotes: 0

Views: 1983

Answers (1)

burrito
burrito

Reputation: 154

        import React,{useState} from 'react';

        const aa = () => {
             const [booblenavalue,setboolenavalue]=useState(false)
                                                                 
             useEffect(() => {
                 setboolenavalue(true)
             }, []);
        }

        export default aa;

Maybe this must be the format of your code

Upvotes: 1

Related Questions