1
export default function PreferVar(){
const [prefer,setPrefer]=useState({})
useEffect(()=>{
fire.database().ref().child('/users/preference').once("value",(snapshot)=>{
    const item=snapshot.val()
    setPrefer(item)
  }
  );},[])
return(prefer)
}

error message Uncaught Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component. where am I and Which rule am I breaking exactly?

rajithShetty
  • 311
  • 1
  • 3
  • 13

0 Answers0