I'm making a signup function with react and firebase right now, and when I sign up, I want to send an authentication code to the e-mail that the user writes. I'm a beginner, so the code may be weird, but is there a way to send the verification code from this code?`
import React, { useRef, useState } from 'react';
import { Card, Button, Form, Alert } from "react-bootstrap"
import { useAuth } from '../contexts/AuthContext';
export default function Signup() {
const emailRef = useRef()
const passwordRef = useRef()
const passwordComfirmRef = useRef()
const { signup, currentUser } = useAuth()
const [error, setError] = useState("")
const [loading, setLoading] = useState(false)
async function handleSubmit(e){
e.preventDefault()
if(passwordRef.current.value !==
passwordComfirmRef.current.value){
return setError('Passwords do not match')
}
try{
setError("")
setLoading(true)
await signup(emailRef.current.value, passwordRef.current.value)
} catch{
setError('we cant create account')
}
setLoading(false)
}
return <>
<Card>
<Card.Body>
<h2 className="text-center mb-4">register</h2>
{currentUser && currentUser.email}
{error && <Alert className='alert alert-danger'>{error}</Alert>}
<Form onSubmit={handleSubmit}>
<Form.Group className='mb-2' id="email">
<Form.Label>email</Form.Label>
<Form.Control type="email" ref={emailRef} />
</Form.Group>
<Form.Group className='mb-2' id="password">
<Form.Label>password</Form.Label>
<Form.Control type="password" ref={passwordRef} />
</Form.Group>
<Form.Group className='mb-4' id="email">
<Form.Label>password comfirm</Form.Label>
<Form.Control type="password" ref={passwordComfirmRef} />
</Form.Group>
<Button disabled={loading} className='w-100' type='submit'>
register
</Button>
<div className='w-100 text-center mt-3'>
do you have account? <a className='text-primary'>lgoin</a>
</div>
</Form>
</Card.Body>
</Card>
</>;
}