
I have a simple form component that is expected to create a new user using the the ###firstName, ###lastName, ###username, and ###password from a react-hook-form application.
Is it possible to create this is user on the click of the form's submit button and have that user created on the appwrite account?

Sure, here is a code sample. Just an FYI I did not test this, it's just a concept of how you might accomplish this.
export default function LoginPage() {
const { register, handleSubmit, formState: { errors } } = useForm();
const onSubmit = (data) => {
try {
const user = await account.create(
ID.unique(),
data.email,
data.password,
data.name
);
const session = await account.createEmailPasswordSession(
data.email,
data.password
);
// navigate to app
} catch (err) {
console.error(err);
}
};
return (
<>
<p className="title">Registration Form</p>
<form onSubmit={handleSubmit(onSubmit)}>
<input type="text" {...register("name")} />
<input type="email" {...register("email")} />
<input type="password" {...register("password")} />
<input type={"submit"} />
</form>
</>
);
}
Recommended threads
- mcp-for-docs not working properly
I'm experiencing issues integrating the MCP server tool with Cursor IDE. The MCP server connection establishes successfully initially but fails after one minute...
- When connecting to VCS (Version Control ...
Hello, when I try to define in my function the root path of a function I get this when I click "Update".
- How do you strategically secure day's wo...
I worked entire day to try and solve how to use clerk such that it handles checking user's authentication purely server-side. I wasted entire day on a loop of a...
