title: login and register in One page using React
body: <p>i'm trying to use login and register in one page in react tsx and this is my code but when i click to show login it's show for like 1 second and then return to signup i don't know why the state change </p>
  
  <pre><code>import React, { ReactElement, Fragment, useState } from 'react'
  
  interface Props { }
  function Home({ }: Props): ReactElement {
      const [login, setlogin] = useState(false);
      return (
          &lt;Fragment&gt;
              &lt;div className="welcomdiv"&gt;
                  &lt;h1 id="weltxt"&gt;Welocme to your Todo List&lt;/h1&gt;
                  &lt;h3 id="strtxt"&gt;Let's Start By Making a Account&lt;/h3&gt;
              &lt;/div&gt;
              {login ?
                  &lt;form className="form-signin"&gt;
                      &lt;input type="email" id="inputEmail" className="form-control" placeholder="Email address" required /&gt;
                      &lt;input type="password" id="inputPassword" className="form-control" placeholder="Password" required /&gt;
                      &lt;button className="btn btn-lg btn-primary btn-block" type="submit"&gt;Sign in&lt;/button&gt;
                  &lt;/form&gt;
                  :
                  &lt;form className="form-signup"&gt;
                      &lt;input type="text" name="username" className="form-control" placeholder="Username" required /&gt;
                      &lt;input type="email" name="email" className="form-control" placeholder="Email address" required /&gt;
                      &lt;input type="password" name="password" className="form-control" placeholder="Password" required /&gt;
                      &lt;input type="password" name="password2" className="form-control" placeholder="Confirm Password" required /&gt;
                      &lt;button className="btn btn-lg btn-primary btn-block" type="submit"&gt;Sign Up&lt;/button&gt;
                  &lt;/form&gt;}
              &lt;p id="logintxt"&gt;Alrady have an Account , Want to &lt;a href="" onClick={() =&gt; setlogin(true)}&gt;Login&lt;/a&gt;&lt;/p&gt;
          &lt;/Fragment&gt;
      )
  }
  export default Home;
  
  </code></pre>