title: TypeError: Cannot read properties of undefined (reading 'setIsAuth')
body: <p>im gettin error: &quot;Login.js:12 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'setIsAuth')&quot;</p>
  <p>Here is my Login.js</p>
  <pre><code>import React from 'react';
  import { auth, provider } from '../firebaseconf';
  import { signInWithPopup } from 'firebase/auth';
  import { useNavigate } from 'react-router-dom';
  
  function Login({ setIsAuth }) {
      let navigate = useNavigate();
  
      const singInWithGoogle = () =&gt; {
          signInWithPopup(auth, provider).then((result) =&gt; {
              localStorage.setItem(&quot;isAuth&quot;, true);
              setIsAuth(true);
              navigate(&quot;/&quot;);
          });
      };
  
      return (
          &lt;div&gt;
              &lt;button onClick={singInWithGoogle}&gt;Sign in with Google&lt;/button&gt;
          &lt;/div&gt;
      );
  
  }
  export default Login;
  
  </code></pre>
  <p>And there is my App.js</p>
  <pre><code>
  import React, { Component } from 'react';
  import './css/main.css';
  import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom';
  import Home from './pages/Home';
  import CreatePost from './pages/CreatePost';
  import Login from './pages/Login';
  
  
  class App extends Component {
  
    constructor(props) {
      super(props);
      this.state = {
        isAuth: false,
        setIsAuth: false
      };
    }
  
    render() {
      return (
        &lt;Router&gt;
          &lt;nav&gt;
            &lt;Link to=&quot;/&quot;&gt;Home&lt;/Link&gt;
            &lt;Link to=&quot;/createpost&quot;&gt; Create New Post&lt;/Link&gt;
            {!this.state.isAuth &amp;&amp; &lt;Link to=&quot;/login&quot;&gt;Login&lt;/Link&gt;}
          &lt;/nav&gt;
          &lt;Routes&gt;
            &lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt;
            &lt;Route path=&quot;/login&quot; element={&lt;Login setIsAuth={this.state.setIsAuth} /&gt;} /&gt;
            &lt;Route path=&quot;/createpost&quot; element={&lt;CreatePost /&gt;} /&gt;
          &lt;/Routes&gt;
        &lt;/Router&gt;
      );
    }
  }
  
  export default App;
  </code></pre>
  <p>i think that i defined it already in App.js in constructor, looking up for ur help, thanks</p>