Sveriges mest populära poddar
The Call Kent Podcast

How to handle action matching no intent?

4 min12 december 2022

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?

Fler avsnitt av The Call Kent Podcast

Visa alla avsnitt av The Call Kent Podcast

The Call Kent Podcast med Kent C. Dodds finns tillgänglig på flera plattformar. Informationen på denna sida kommer från offentliga podd-flöden.