title: Couldn't find a navigation object. Is your component inside a screen in a navigator?
body: <p>In My below code when I use useNavigation() then it gives an error like my quiestion
  How to use useNavigation, Please any one can solve this error... ERROR:Couldn't find a navigation object. Is your component inside a screen in a navigator?
  I followed code from here <a href="https://rnfirebase.io/messaging/notifications#handling-interaction" rel="noreferrer">https://rnfirebase.io/messaging/notifications#handling-interaction</a></p>
  <pre><code>import React, {useState, useEffect } from 'react';
  import messaging from '@react-native-firebase/messaging';
  import { NavigationContainer, useNavigation } from &quot;@react-navigation/native&quot;;
  import { createStackNavigator, HeaderTitle, } from &quot;@react-navigation/stack&quot;;
  const Stack = createStackNavigator();
  
  function App(props) {
       const navigation = props.navigation
      //const navigation = useNavigation();
      const [initialRoute, setInitialRoute] = useState('Splash Screen');
  
      useEffect(() =&gt; {
          messaging().onMessage(remoteMessage =&gt; {
              navigation.navigate(&quot;Description Screen&quot;);
              console.log(props.navigation)
          });
      }, []);
  
      return (
          &lt;NavigationContainer&gt;
              &lt;Stack.Navigator
                  initialRouteName={initialRoute}
                  headerMode=&quot;none&quot;
                  screenOptions={{
                      gestureEnabled: true,
  
                  }}
              &gt;
  
                  &lt;Stack.Screen name=&quot;Splash Screen&quot; component={SplashScreen} /&gt;
                  &lt;Stack.Screen name=&quot;Description Screen&quot; component={DescriptionScreen} /&gt;
              &lt;/Stack.Navigator&gt;
  
          &lt;/NavigationContainer&gt;
  
      );
  }
  
  export default App;
  </code></pre>