> For the complete documentation index, see [llms.txt](https://docs.feathery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.feathery.io/develop/react/api-guide/form/event-handlers/onload.md).

# onLoad()

### Overview

This is a [\<Feathery.Form>](/develop/react/api-guide/form.md) prop and callback function to run custom logic when a form step is loaded. It's called every time the user loads a step. This function can be asynchronous.

### Usage

You can use `onLoad` to update internal form state, log events, etc. The function takes a single [Context](#context-api) object that provides form-related state and handlers.

```
import { init, Form } from '@feathery/react';

function App() {
  // Initialize Feathery
  init('SDKKey', 'bob@feathery.io');

  // Show the `aBcDeF` Feathery form
  return <Form
    aBcDeF='aBcDeF'
    // Custom form step load logic
    onLoad={(context) => {
      if (context.stepName === 'begin') context.setValues({'beginForm': True});
      else if (context.stepName === 'next-step') logEvent("Loaded Step 2");
    }}
  />
}
```

### Context API

|                   Key                   | Type | Description                                     |
| :-------------------------------------: | :--: | ----------------------------------------------- |
| [Form Context](/develop/context-api.md) |      | Consistently available form state and functions |

### Return value <a href="#return-value" id="return-value"></a>

A promise can be optionally returned from this function if it's asynchronous and you want execution to await.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.feathery.io/develop/react/api-guide/form/event-handlers/onload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
