@oneblink/apps-react
    Preparing search index...

    Function useFormSubmissionState

    • This function is a simple wrapper around the react hook useState(). The results can be passed to the <OneBlinkForm /> component.

      import {
      useFormSubmissionState,
      OneBlinkFormControlled,
      } from '@oneblink/apps-react'

      function Uncontrolled({ form, initialSubmission, ...props }) {
      const [{ definition, submission }, setFormSubmission] =
      useFormSubmissionState(form, initialSubmission)

      return (
      <OneBlinkFormControlled
      {...props}
      definition={definition}
      submission={submission}
      setFormSubmission={setFormSubmission}
      lastElementUpdated={lastElementUpdated}
      />
      )
      }

      Parameters

      • form: Form

        The OneBlink Form to render

      • OptionalinitialSubmission: { [name: string]: unknown }

        The initial submission data to populate the form with

      • OptionallastElementUpdated: FormElement
      • OptionalsectionState: { id: string; state: "COLLAPSED" | "EXPANDED" }[]

      Returns [
          {
              definition: Form;
              executedLookups: ExecutedLookups;
              lastElementUpdated: FormElement
              | undefined;
              sectionState:
                  | { id: string; state: "COLLAPSED"
                  | "EXPANDED" }[]
                  | undefined;
              submission: { [name: string]: unknown };
          },
          Dispatch<
              SetStateAction<
                  {
                      definition: Form;
                      executedLookups: ExecutedLookups;
                      lastElementUpdated: FormElement
                      | undefined;
                      sectionState:
                          | { id: string; state: "COLLAPSED"
                          | "EXPANDED" }[]
                          | undefined;
                      submission: { [name: string]: unknown };
                  },
              >,
          >,
      ]