how to pass parameter onclick react code example

Example 1: react onclick parameter

import React from 'react';

const ExampleComponent = () => {
  
  function sayHello(name) {
    alert(`hello, ${name}`);
  }
  
  return (
    <button onClick={() => sayHello('James')}>Greet</button>
  );
}

export default ExampleComponent;

Example 2: how to call a function in react with arguments onclick

<button onClick={() => sayHello('James')}>Greet</button>

Example 3: reactjs pass slug to parameter onclick

return (
  <th value={column} onClick={() => this.handleSort(column)}>{column}</th>
);