Skip to content

v4.0.0

Latest
Compare
Choose a tag to compare
@jucian0 jucian0 released this 04 Jun 21:56
· 34 commits to main since this release

New release v4.0.0 πŸš€ πŸš€ πŸ₯³

Features

loadData

The loadData feature allows you to retrieve form values from an external API and set them as the initial values of a form.

Example usage:

const useLoginForm = createForm<Form>({
  initialValues: {
    email: "",
  },
  mode: "onSubmit",
  loadData: async (id)=> {
    try {
      return await getFormValues();
    } catch (e) {
      return {};
    }
  },
});

onSubmit

TheonSubmit feature enables you to submit a form.

Example usage:

const useLoginForm = createForm<Form>({
  initialValues: {
    email: "",
  },
  mode: "onSubmit",
  onSubmit: values =>{
    // post or update
}
});

Please note that the above code is just an example, and you may need to adapt it to your specific use case.