When using React or any other frontend framework, values are usually submitted using onClick. There are some pitfalls with such approach and that is:

  • double clicking and stopping the action
  • double clicking and other requests finishing the job much sooner (it may throw an error during last request while the first one might be successful)

To fix those issues and/or not having to think about those, you can wrap a button with a Form and let it do its job. You can then read the value in your function and the name as well.

<Button name="intent" value="delete">Test</Button>  

This will only work if you don’t use 3rd party libraries