← Back to Guides

Use ActionData to get form post body in Remix

Remix allows you to handle form submissions with the action method

The response of the action method is available through the useActionData hook

import { useActionData, json } from "remix"
export const action = async ({ request }) => {
return json({
token: "1234567890",
})
}
export default function Page() {
const { token } = useActionData()
// do something with token
}