Skip to content

Slightly awkward to wrap process in a form tag #30

Description

@itsdouges

Hey! Started using your library for a side project. One case I wanted was to be able to wrap it in a form element (maybe it would be good to do it out of the box?).

I had to do this atm:

          <FormProcessor renderer={materialUiRenderer}>
            <Form onSubmit={console.log}>
              <FormFragment defaultFields={form} />
              <Button type="submit">submit</Button>
            </Form>
          </FormProcessor>

where <Form> is:

export const Form = (props) => (
  <FormContext.Consumer>
    {(form: any) => (
      <FormRoot
        {...props}
        onSubmit={e => {
          e.preventDefault();
          if (form.isValid) {
            props.onSubmit(form.value);
          }
        }}
      />
    )}
  </FormContext.Consumer>
);

Also with the docs you have atm I kept having to jump around to the src/packages/demo to see the implemented code - I think it'd be great if your examples also had some example usage next to them as well, not just the schema definition :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions