I'm trying to run several functions in a useEffect after the internet connection state resolves to true. But at the start, the status will be null and then it will resolve to true. As a result the rest of the functions will not be invoked. How to resolve this conflict?
I want to run the functions only once
const Component = () => {
const {isConnected} = useNetInfo();
useEffect(() => {
runFunctionOne();
runFunctionTwo();
}, []);
const runFunctionOne = () = {
if (!isConnected) return;
// rest
}
const runFunctionTwo = () = {
if (!isConnected) return;
// rest
}
}