Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
673 B
1
Indexable
Never
import React, { useState } from 'react';
import Login from './Login'; // Import the Login component
import Signup from './Signup'; // Import the Signup component

const LoginSignupPage = () => {
  const [showLogin, setShowLogin] = useState(true); // State to toggle between login and signup forms

  return (
    <div>
      {showLogin ? <Login /> : <Signup />} {/* Render the Login or Signup component based on showLogin state */}
      <button onClick={() => setShowLogin(!showLogin)}>
        {showLogin ? 'Switch to Signup' : 'Switch to Login'} {/* Button to toggle between login and signup forms */}
      </button>
    </div>
  );
};

export default LoginSignupPage;
Leave a Comment