informed icon indicating copy to clipboard operation
informed copied to clipboard

onSubmit - setError is not a function

Open cherring07 opened this issue 2 years ago • 0 comments

Perhaps undocumented (sorry if I have missed it)

When using the useFormAPI hook with setError within onSubmitI get the following error.

formApi.setError is not a function

const Test= () => {
  const formApi = useFormApi();

  const onSubmit = () => {
    formApi.setError('example', 'error!');
  };
  
  render (  
     <Form onSubmit={onSubmit}>
      <Input name="example" label="Example" />
      <button type="submit">Submit</button>)
     </Form>
     );
}

cherring07 avatar Nov 22 '22 15:11 cherring07