Skip to content

RefineDev Example #4363

@aress31

Description

@aress31

Prerequisites

What theme are you using?

mui

What is your question?

I've spent the whole day attempting to integrate @refinedev/react-hook-form with @rjsf/mui, but the absence of a registration prop on the Form makes it inaccessible for my react-hook-form to receive updates. Merely setting the onChange doesn't seem to suffice. Here's a minimal example:

const ModalForm = ({
  modalProps: {
    formState,
    getValues,
    handleSubmit,
    modal,
    register,
    refineCore,
    saveButtonProps,
    setValue,
    ...rest
  },
  supabaseColumns,
}) => {
  console.log({
    formState,
    getValues,
    handleSubmit,
    modal,
    refineCore,
    saveButtonProps,
    setValue,
    ...rest,
  });

  return (
    <Form
      schema={createSchema(supabaseColumns)}
      uiSchema={createUiSchema(supabaseColumns)}
      formData={getValues()}
      validator={validator}
      onChange={(e) =>
        Object.entries(e.formData).forEach(([key, value]) =>
          setValue(key, value)
        )
      }
    />
  );
};

Help would be appreciated - also worth documenting how to wire data with RHF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions