useActionData()

Use useActionData() to read the latest action result for the current matched route node.

const actionData = useActionData()
  • useActionState()
  • useRouteActionData(routeId)
  • useFormAction()

useActionState()

useActionState() returns a richer object:

  • data
  • error
  • status

Status is one of:

  • idle
  • submitting
  • success
  • error

useRouteActionData(routeId)

Use route ids for the strongest typing:

const layoutActionData = useRouteActionData('layout')

If you omit the route id, Horn resolves the parent route id relative to the current matched node.

useFormAction()

useFormAction(action?) resolves the effective action URL for the current route when you want to wire forms manually.