Releases: jucian0/createform
Releases ยท jucian0/createform
v4.0.0
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.
V3.5.0
New release v3.5.0 ๐ ๐
Feature
useForm() - This hook enables the seamless creation of forms in a native and intuitive manner.
const { register, errors, getErrors, setFieldValue, getValues } = useForm({
initialValues: data,
onSubmit,
});
function onSubmit(e: typeof data) {
console.log(e);
}
return (
<form {...register()}>
<Input name="name" />
<button>Submit</button>
<button typw="reset">Reset</button>
</form>
}
v3.4.0
v3.3.25
v3.3.7
v3.3.3
V3.3.1
V3.2.4
3.1.0
v3.0.0
3.0.0 (2022-01-23)
Features
- createform: new function to create a form (289df80)
- debounce: add a debounce function (bbd5a63)
- exception: add new exception handle (b8fe654)
- fieldutild: add functions to deal with fields and their references (f07080a)
- hooks: remove old implementation (e049371)
- objectutils: dot-prop implementation (a1ad34a)
- package.json: remove unused packages (da2c669)
- store: add Store to keep the form state (7f17381)
- types: add new types (63b5de2)
- types: add new types to new implementation (49c9c76)
- utils: remove old implementation (788a910)
- validate: add Validate function to deal with errors (ccf09fd)
- wrapper: wrapper component allow to use custom fields (16f46ee)
Tests
- tests: add new tests (a8cf886)
BREAKING CHANGES
- wrapper: Wrapper is the new way to register a custom component
- createform: Changes the way to create a form
- tests: This change introduce createForm function, this function is the new way to create
forms.