0.4.1 • Published 1 year ago

@beekai/react v0.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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' // BEEKAI form applicaiton id
})

if (submissionId) {
  return <p>Thank you! Submission Id is: {submissionId}</p>
}

if (errors?.serverError) {
  return <p>Server error and submission failed.</p>
}

// native submit
return (
  <form onSubmit={onSubmit}>
    <input {...register('data')} />
  </form>
}

// custom submit
return (
  <form onSubmit={handleSubmit(async (data) => {
    await submit(data)
  })}>
    <input {...register('data')} />
  </form>
}
0.4.1

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.3.1

1 year ago

0.1.0

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago