goToPreviousPage
API / @publicodes/forms / goToPreviousPage
function goToPreviousPage<RuleName>(formState): FormState<RuleName>
Defined in: form.ts:199
Navigates to the previous page in the form.
Type Parameters
Type Parameter | Description |
---|---|
RuleName extends string | The existing rule names |
Parameters
Parameter | Type | Description |
---|---|---|
formState | FormState <RuleName > | The current state of the form |
Returns
FormState
<RuleName
>
A new form state positioned at the previous page. If already on the first page, returns the original state unchanged
Example
const prevState = goToPreviousPage(formState)
if (prevState === formState) {
// We were already at the first page
}