This code creates a reset button and a div that holds a text box and a button. When the user clicks the button, the code calls the sendPasswordResetEmail function with the user's email address as the argument. The sendPasswordResetEmail function sends a password reset email to the user.

    Library: react

    import { auth, sendPasswordResetEmail } from "./firebase";
    import { Link } from "react-router-dom";
    import { useAuthState } from "react-firebase-hooks/auth";
    import "./Reset.css";
    import React, { useEffect, useState } from "react";
    import { useNavigate } from "react-router-dom";
    function Reset() {
      const [email, setEmail] = useState("");
      const [user, loading, error] = useAuthState(auth);
      const navigate = useNavigate();
      useEffect(() => {
        if (loading) return;
        if (user) navigate("/dashboard");
      }, [user, loading]);
      return (
        <div className="reset">
          <div className="reset__container">
              onChange={(e) => setEmail(}
              placeholder="E-mail Address"
              onClick={() => sendPasswordResetEmail(email)}
              Send password reset email
              Don't have an account? <Link to="/register">Register</Link> now.
    export default Reset;
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.