This change exports the generateFormData function.
When implementing optimistic ui via useFetcher, we need to get the parsed data from fetcher.formData. We cannot use parseFormData because it returns a promise but it's possible if we use the generateFormData function which is not async.
const fetcher = useFetcher();
// This should have the correct json data for optimistic ui
const pendingItems = fetcher.formData ? generateFormData(fetcher.formData) : null
Description
This change exports the
generateFormData
function.When implementing optimistic ui via
useFetcher
, we need to get the parsed data fromfetcher.formData
. We cannot useparseFormData
because it returns a promise but it's possible if we use thegenerateFormData
function which is not async.This should also partially resolve this discussion: https://github.com/Code-Forge-Net/remix-hook-form/discussions/24
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
generateFormData
Checklist: