title: Cant use navigate on UseEffect React Native for Splash Screen
body: <p>Hello guys so I'm trying to make Splash Screen with Stack Navigator. So I Have 3 Main Files App.js , Home.js, and SplashScreenJs. I want my Splashscreen to move into Home after 5 seconds but I can't afford to make it. I was able to use console log with the UseEffect but not with the navigate. It shows error &quot; ReferenceError: Can't find variable: navigation&quot;</p>
  <p>App.js Code:</p>
  <pre><code>const Stack = createStackNavigator();
  
  const App = () =&gt; {
    return (
      &lt;NavigationContainer&gt;
        &lt;Stack.Navigator
          screenOptions={{
            header: () =&gt; null
          }}
        &gt;
          &lt;Stack.Screen 
            name='Splash Screen' 
            component={SplashScreen}
          /&gt; 
          
          &lt;Stack.Screen 
            name='Home' 
            component={Home}
          /&gt; 
        &lt;/Stack.Navigator&gt; 
      &lt;/NavigationContainer&gt;
    );
  };
  </code></pre>
  <p>SplashScreen.js</p>
  <pre><code>const SplashScreen = () =&gt; {
    useEffect(() =&gt; {
      const timer = setTimeout(()=&gt;{
        navigation.navigate('Home')
      }, 5000);
    });
    
    return (
        &lt;LinearGradient colors={['#53CDE2','rgba(83, 205, 226, 0.43)','rgba(83, 205, 226, 0.25)']} style={styles.SplashWrapper}&gt;
            &lt;Image source={require('../assets/logo.png')}/&gt;
            &lt;Text style={styles.SplashSlogan}&gt;Well Organized, Better Day&lt;/Text&gt; 
        &lt;/LinearGradient&gt;
    )
  }
  </code></pre>
  <p>Can someone help me please ?</p>