The Context Object ​
The context object is the single source of truth passed to multiple functions as arguments and as render props. It contains everything ReactForm knows about the current state bundled into a neat, opinionated object.
{
isNewItem: Boolean,
normalizedFields: Array,
values: Object,
initialValues: Object,
dirtyValues: Object,
touched: Array,
dirty: Array,
errors: Object,
error: Object,
itemId: String|Number,
isReading: Boolean,
isCreating: Boolean,
isUpdating: Boolean,
isDeleting: Boolean,
isArchiving: Boolean,
isUnarchiving: Boolean,
isLoading: Boolean,
isArchived: Boolean,
setValue: Function,
getFieldError: Function,
setFieldError: Function,
setFieldErrors: Function,
clearErrors: Function,
clearFieldError: Function,
readItem: Function,
createItem: Function,
updateItem: Function,
deleteItem: Function,
archiveItem: Function,
unarchiveItem: Function,
}isNewItem ​
true when the form is in create mode, false when editing an existing item.
normalizedFields ​
Processed field configuration with defaults applied and internal transformations.
values ​
Current form values as key-value pairs. Updates reactively as users input data.
initialValues ​
The initial values when the form was loaded or last saved. Used to determine dirty state.
dirtyValues ​
Only the fields that have been modified since the form loaded or last saved.
touched ​
Array tracking which fields have been focused or interacted with by the user.
dirty ​
Array tracking which fields have been modified from their initial values.
errors ​
Object containing field-level validation errors. Set via setFieldError or setFieldErrors.
error ​
Form-level error object formatted by errorAdapter. Contains name, message, and fieldErrors.
itemId ​
The unique identifier of the item being edited.
isReading ​
true while the read method is fetching data on mount.
isCreating ​
true while the create method is executing after clicking the <ReactFormCreate> button.
isUpdating ​
true while the update method is executing after clicking the <ReactFormUpdate> button.
isDeleting ​
true while the delete method is executing. Used with <ReactFormDelete> button.
isArchiving ​
true while the archive method is executing. Used with <ReactFormArchive> button.
isUnarchiving ​
true while the unarchive method is executing. Used with <ReactFormUnarchive> button.
isLoading ​
true when any async operation is in progress (reading, creating, updating, deleting, archiving, or unarchiving).
isArchived ​
true if the current item has been marked as archived.
setValue ​
Function to manually set a field value. Signature: (fieldName: string, value: any) => void
getFieldError ​
Function to get error for a specific field. Signature: (fieldName: string) => Object|string|null
setFieldError ​
Function to set error for a specific field. Signature: (fieldName: string, error: Object|string|null) => void
setFieldErrors ​
Function to set multiple field errors at once. Signature: (fieldErrors: Object) => void
clearErrors ​
Function to clear all field errors.
clearFieldError ​
Function to clear error for a specific field. Signature: (fieldName: string) => void
readItem ​
Function to manually trigger the read operation.
createItem ​
Function to manually trigger the create operation.
updateItem ​
Function to manually trigger the update operation.
deleteItem ​
Function to manually trigger the delete operation.
archiveItem ​
Function to manually trigger the archive operation.
unarchiveItem ​
Function to manually trigger the unarchive operation.