Sign Up Users
src/Pages/SignUpPage.jsx
import React, { useState } from "react";
import { createUserWithEmailAndPassword } from "firebase/auth";
import { auth } from "../Configs/firebase";
import {
Box, Input, Button
} from "@chakra-ui/react";
function SignUpPage(){
const [email,setEmail] = useState();
const [password,setPassword] = useState();
const createUser = ()=>{
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
// ..
});
}
return (
<Box>
<Input type='email' placeholder='email' />
<Input type='password' placeholder='password'/>
<Button onClick={()=> createUser()}>Sign Up</Button>
</Box>
)
}
Last updated
Was this helpful?