I have a NextJS project using the app router and I need a button that deletes a cookie when clicked. I’m achieving this by creating a form
that contains only the button
so that way the sever action can be triggered via the button:
<code><form action={deleteCookie}>
<button type="submit">Delete Cookie</button>
</form>
</code>
<code><form action={deleteCookie}>
<button type="submit">Delete Cookie</button>
</form>
</code>
<form action={deleteCookie}>
<button type="submit">Delete Cookie</button>
</form>
Is this the correct way to achieve this? It does work. It just seems like kinda of an odd way of doing things.