import React, {useState} from 'react'; import { Authorization} from '../../types'; import SignInForm from './SignInForm'; import {makeStyles} from "@material-ui/core"; import Registration from "./Registration"; interface PropTypes { logIn: (name: string, password: string) => Promise; } const useStyles = makeStyles(theme => ({ authorize: { display: 'flex', width: 200, justifyContent: 'space-around', margin: '0 auto' } })); const AuthPage: React.FC = ({logIn}) => { const classes = useStyles(); const[authorization,setAuthorization] = useState({authorize: 'signUp'}); const handleSignUp = () => { setAuthorization({authorize: 'signUp'}); console.log(authorization.authorize); }; const handleRegistration = () => { setAuthorization({authorize: 'registration'}); console.log(authorization.authorize); }; return ( <>
SignUp
or
Registrate
{ authorization.authorize === 'signUp' && } { authorization.authorize === 'registration' && } ); }; export default AuthPage;