'Toastify does not work on the register page in react

I want to show a toast when user will be sign up and getting verification email. But Toast dosen't show.

const navigate=useNavigate();
const from = location.state?.from?.pathname || "/";    
const[confirmPassword, setConfirmPassword]=useState("");

const [
    createUserWithEmailAndPassword,
    user,
    loading,
    error,
  ] = useCreateUserWithEmailAndPassword(auth, {sendEmailVerification: true} );

  if(loading){
    
    return <div><Loading></Loading></div>
  }

  let element;
if (error) {
    element = <p>Error: {error.message}</p>
}
  if (user) {
    navigate(from, { replace: true });
    toast('sending email verification')
      
  }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source