Skip to content

How to implement multiple submit actions #102

Closed Answered by zanozbot
zanozbot asked this question in Q&A
Discussion options

You must be logged in to vote

I ended up using the useSubmit hook. It's not the prettiest solution but it gets the job done.

import { zodResolver } from "@hookform/resolvers/zod";
import { ActionFunctionArgs } from "@remix-run/node";
import { Form, useSubmit } from "@remix-run/react";
import { getValidatedFormData, useRemixForm } from "remix-hook-form";
import zod from "zod";
import { Button } from "~/components/ui/button";
import { Input } from "~/components/ui/input";

const item = zod.object({
  title: zod.string().max(255).optional(),
});
type Item = zod.infer<typeof item>;
const resolver = zodResolver(item);

export const action = async ({ request, params }: ActionFunctionArgs) => {
  if (request.method === "DELETE"

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zanozbot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant