Reputation: 337
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
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