# usePrepare

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

Plans a write without sending it: its steps, calls and warnings, for a review screen before the wallet prompt. Signature, result and examples for usePrepare.

Source: https://ensforge.com/docs/reference/react/use-prepare

<ApiMeta kind="Write hook" stability="stable" since="1.0.0" source="packages/react/src/hooks/usePrepare.ts#L42" />

Plans a write without sending it: its steps, calls and warnings, for a review screen before
the wallet prompt.

## When to use [#when-to-use]

Use to show what a write will do (how many transactions, approvals, warnings) and to disable
the submit button while it cannot be planned, e.g. when the account lacks permission.

## Signature [#signature]

```ts
function usePrepare<action extends PreparableAction>(action: action, options: ActionOptions<action["prepare"]> | undefined, config?: ReadConfig): ReadResult<Plan, ActionError<action["prepare"]>>
```

## Examples [#examples]

```tsx title="Reviewing a records update"
import { Actions } from "@ensforge/sdk"
import { usePrepare } from "@ensforge/react"

function Review({ name, url }: { name: string; url: string }) {
  const { data: plan, error } = usePrepare(Actions.record.set, { name, texts: { url } })
  if (error) return <p>{error.message}</p>
  return <p>{plan?.steps.length} transaction(s)</p>
}
```

## See also [#see-also]

- The [hook types](/docs/reference/react#types): `ReadResult`, `WriteResult` and `ReadConfig`.