This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generic hook for submitting data via fetcher using FormData. | |
* Relies on React Router 7's type generation for the action's return type. | |
* | |
* @template TSchema - The Zod schema type for input data validation and type inference. | |
* @template TActionReturn - The specific return type of the target route's action function (inferred via RR7 typegen). | |
* @param _schema - Zod schema (used primarily for type inference of the 'data' in submit). | |
* @param actionUrl - The target URL for the fetcher submission. | |
* @param prepareFormData - A function that takes the typesafe data object (z.infer<TSchema>) and returns a FormData instance. |