--- title: useFormAction new: true --- # `useFormAction`
Type declaration ```tsx declare function useFormAction( action?: string, { relative }: { relative?: RelativeRoutingType } = {} ): string; ```
This hook is used internally in [`
`][form] to automatically resolve default and relative actions to the current route in context. While uncommon, you can use it directly to do things like compute the correct action for a ` ); } ``` It's also useful for automatically resolving the action for [`submit`][usesubmit] and [`fetcher.submit`][usefetchersubmit]. ```tsx let submit = useSubmit(); let action = useFormAction(); submit(formData, { action }); ``` [form]: ../components/form [usesubmit]: ./use-submit [usefetchersubmit]: ./use-fetcher#fetchersubmit