i need to use the NetInfo.isConnected in a variable to send to my if statement, but all examples i see in internet are the same, just console.log the value, never put inside a variable
function verifyConnection() {
let isConnected;
NetInfo.fetch().then((state) => {
isConnected = state.isConnected;
});
return isConnected;
}
always return undefined, but if a put into a variable like this
let isConnected = NetInfo.fetch().then((state) => {state.isConnected});
return : LOG {"_A": null, "_x": 0, "_y": 0, "_z": null}
how to use netinfo inside a if statemente to test my connection status