Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created January 21, 2022 16:56
Show Gist options
  • Save ryanflorence/9b1ace78b737bfa4ac33930a05bfe361 to your computer and use it in GitHub Desktop.
Save ryanflorence/9b1ace78b737bfa4ac33930a05bfe361 to your computer and use it in GitHub Desktop.
// hard, buggy, incomplete, slower
<button
onClick={async () => {
setLoading(true);
let result = await updateProject({
status: "active"
});
setLoading(false);
setResult(result);
}}
>
Activate
</button>
// easy, not buggy, complete, faster
<Form method="post" action="/project/123/update">
<input type="hidden" name="status" value="active" />
<button type="submit">Activate</button>
</Form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment