Answers for "useEffect not called in React Native when back to screen"

0

useEffect not called in React Native when back to screen

//Solved : useEffect not called in React Native when back to screen
import React, { useEffect } from "react";
import { useIsFocused } from "@react-navigation/native";

const ExampleScreen = (props) => {
    const isFocused = useIsFocused();

    useEffect(() => {
        console.log("called");
        getInitialData();
    }, [props, isFocused]);

    const getInitialData = async () => {}    

    return (
        ......
        ......
    )
}
Posted by: Guest on August-18-2021

Code answers related to "useEffect not called in React Native when back to screen"

Code answers related to "Javascript"

Browse Popular Code Answers by Language