'Couldn't find a navigation object

I can not speak English well. I get an error when I add useFocusEffect function to app.js file.
Error : Couldn't find a navigation object. Is your component inside NavigationContainer?

App.js

import { useState, useCallback } from "react";
import { NavigationContainer, useFocusEffect,  } from "@react-navigation/native";
const Stack = createStackNavigator();

function App() {
    const [isLogin, setLogin] = useState("");
    useFocusEffect(
        useCallback(async() => {
           //....
        }, [isLogin])
    );
return (
        <NavigationContainer ref={navigationRef}><Stack.Navigator>
            {isLogin == "" ? (
                <Stack.Group>
                    <Stack.Screen
                        name="Home"
                        component={Home}
                        options={{ headerShown: false, title: "Anasayfa" }}
                    />
                </Stack.Group>
            ) : (
                <Stack.Group screenOptions={{ headerShown: false }}>
                   <Stack.Screen
                        name="Conference"
                        component={Conference}
                        options={{ title: "", headerTintColor: "#000" }}
                    />
                </Stack.Group>
            )}
        </Stack.Navigator>
        </NavigationContainer>
    )
}

export default App;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source