Illustration of a microphone

Calls with Kent C. Dodds.

You call, I'll answer.

Listen to the podcasts here
Phone sitting on a stool

What's this all about?

The goal of the Call Kent Podcast is to get my answers to your questions. You record your brief question (120 seconds or less) right from your browser. Then I listen to it later and give my response, and through the magic of technology (ffmpeg), our question and answer are stitched together and published to the podcast feed.

I look forward to hearing from you!

Record your call

Calls with Kent C. Dodds — 122 episodes

116.How to handle action matching no intent?
04:25
Keywords

intent, action, function

Tweet this
Description

Hi Kent its Jan,

What do you do in your action function in Remix for a page with multiple forms, if no intent matches?

Let's say you have a page with two forms, one for deleting an entity and one for duplicating it. So the page has two forms each with a button of type submit, one with an intent of delete and one of with an intent of duplicate.

Now what do you do if the request to that action function contains form data with neither intent?

In Ryan's Remix single, where he shows how to handle multiple forms, his action is a void promise and returns nothing in the case where none of his intents match.

But should you do that in a production app? Just don't do anything?

Thanks for your help! And thank you for answering yesterdays question about testing tables, it helped me out tremendously.

Take care!

How to handle action matching no intent?

Looking for more content?

Have a look at these articles.

See the full blog