Now UI Kit 2 is GA and ErrorMessage is available.
Can you help with how to set errors messages in the form in case of errors during submit?
<Form onSubmit={handleSubmit(submit)}>
...
<Textfield {...register("name")} />
{errors.name && (
<ErrorMessage>{errors.name.message}</ErrorMessage>
)}
...
</Form>
const submit = async (data) => {
console.log("Form data", data);
const requestBody = {
projectId: projectId,
name: data.name
};
const response = await invoke("someJiraBackendCall", requestBody );
console.log("Response data", response);
if (response.errors) {
//TODO How to create now the form errors?
//TODO What to write here to populate ErrorMessage for the form field?
}
}