import React, { useState } from "react"; import { useAuth } from "../../hooks"; export const Register = () => { const { register } = useAuth(); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [confirmation, setConfirmation] = useState(""); const [error, setError] = useState(); const onSubmit = async (e) => { e.preventDefault(); const response = await register(username, password, confirmation); if (response && !response.success) { setError(response.error); } }; return (
{error}
}