https://linguinecode.com/post/how-to-pass-parameter-values-to-onclick-react-function

PHOTO EMBED

Tue Aug 09 2022 22:32:53 GMT+0000 (Coordinated Universal Time)

Saved by @vnmshenoy

const handleClick = event => console.log(event.target.dataset) // {mssg: "Hello!"}

const FooBar = () => <button data-mssg="Hello!" onClick={handleClick}>Speak</button>;
content_copyCOPY

https://linguinecode.com/post/how-to-pass-parameter-values-to-onclick-react-function