In the code snippet below, how can you pass an argument to the handleClick function?
function MyButton() {
const handleClick = (name) => {
alert(name);
};
return <button onClick={handleClick}>Click Me</button>;
}
onClick={handleClick('John')}
onClick={() => handleClick('John')}
onClick={handleClick, 'John'}
onClick={handleClick}
This question is part of this quiz :
Event Handling in React