Using ActionData to get form post body in Remix

Last updated February 11, 2022 by Jacob Paris

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