Skip to main content

useFormState

Core form state management hook. Used internally by OSForm — exposed for advanced custom renderers.

Parameters

FormState

FormStateActions

Example: custom renderer

showWelcome is set from the schema on the hook’s first render. If the schema loads later (as with useFormSchema), the welcome screen won’t show. Render the component that calls useFormState only once the schema has loaded if you need the welcome screen.
The submission is JSON keyed by field id, covering visible non-statement fields. Unanswered fields are sent as "", and settings.source (if set) is sent as _source.

useFormSchema

Fetches a form schema from the OSForms API.

Return value

Fetches from: {baseUrl}/api/v1/f/{formId}/schema. Passing an empty formId skips the fetch and leaves loading as true.