Created
January 21, 2022 16:56
-
-
Save ryanflorence/9b1ace78b737bfa4ac33930a05bfe361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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