Closed abustany closed 6 months ago
Aha, looks like I can simply use the serialize
and deserialize
methods, like this:
export async function action({request}: ActionFunctionArgs) {
const data = deserialize(await request.json());
}
export default Component() {
const fetcher = useFetcher();
fetcher.submit(serialize(myObject), {encType: "application/json"});
}
I was just going to comment on that. Glad you figured it out.
useTypedFetcher
allows getting correctly typed data from the server to the frontend, however it does not seem to be helping when callingfetcher.submit
with an object as the target? It feels like we could use the current encoding for "complex" values not only for receiving data, but also for sending data to the server?