beekai-react
This library contains hooks to work with beekai form. It's a wrapper with react-hook-form
Usage
const {
submit,
onSubmit,
register,
handleSubmit,
submissionId,
formState: { errors }
} = useBeikai({
formId: 'beekai-form-id'
})
if (submissionId) {
return <p>Thank you! Submission Id is: {submissionId}</p>
}
if (errors?.serverError) {
return <p>Server error and submission failed.</p>
}
return (
<form onSubmit={onSubmit}>
<input {...register('data')} />
</form>
}
return (
<form onSubmit={handleSubmit(async (data) => {
await submit(data)
})}>
<input {...register('data')} />
</form>
}