Hook state is undefined SDK 40

Please provide the following:

  1. SDK Version: 49
  2. Platforms(Android/iOS/web/all): Web, Android and iOS

Hook state is undefined.

export default function NoInternet() {
  const { network, updateNetwork } = useState(false);

  useEffect(() => {
    updateNetwork(true); //This method is undefined
    console.log(network); //This return undefined
  }, []);

  return <View>
      <Text>{network? "Internet is working": "Please check your internet."}</Text>


Hi @geek_lekan,

According to the documentation your code should look like:

const [ network, updateNetwork ] = useState(false);
1 Like

ARRRGH, I can’t believe I missed that. Thanks @cornel.raiu


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.