title: How to change page after login button click ReactJS
body: <p>I am making a login page on ReactJS and I would like to load a other page if the login is succesful. I am also using Firebase and react router)</p>
  
  <p>This is a part of my "<em>Login.js</em>":</p>
  
  <pre><code>import React, {useState} from 'react'
  import Fire from "../firebase config/Firebase"
  
  function Login(){
  
  
      const Login_Submit = () =&gt; {
          Fire.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
              // Handle Errors here.
              var errorCode = error.code;
              var errorMessage = error.message;
              // ...
              console.log(errorCode + errorMessage)
          });
  
  
          Fire.auth().onAuthStateChanged(function(user) {
              if (user) {
                // User is signed in.
                // This is where I want to load a other page
              } else {
                // No user is signed in.
              }
          });
      }
  
  
      return(
  
          &lt;div&gt;
                  &lt;div&gt;
                      &lt;form className = "form-username"&gt;
                          &lt;input className = "username" type="email" placeholder = "Email" value = {email} onChange = {refresh_mail}/&gt;
                      &lt;/form&gt;
  
                      &lt;form className = "form-password"&gt;
                          &lt;input className = "password" type="password" placeholder = "Password" value = {password} onChange = {refresh_password}/&gt;
                      &lt;/form&gt;
  
                      &lt;div className = "buttons"&gt;
                          &lt;button className = "button is-primary login" onClick = {Login_Submit}&gt;Login&lt;/button&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
          &lt;/div&gt;
  
      )
  
  
  }
  
  
  export default Login
  </code></pre>
  
  <p>I am a beginner on ReactJS so thanks for the help !</p>