import React, { useState } from 'react'; import { TextField, Button, Container, Typography } from '@mui/material'; import { createUserWithEmailAndPassword } from 'firebase/auth'; import { auth } from '../firebase'; const RegisterPage = () => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const handleRegister = async () => { if (password.length < 8) { setError('The password should be minimum 8 digits'); return; } try { await createUserWithEmailAndPassword(auth, email, password); } catch (error) { setError(error.message); } }; return ( Register setEmail(e.target.value)} fullWidth /> setPassword(e.target.value)} fullWidth /> {error && {error}} ); }; export default RegisterPage;