Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react onclick with event

const App = () => {
  const handleClick = (event, param) => {
    console.log(event);
    console.log(param);
  };

  return (
    <div>
      <button onClick={event => handleClick(event, 'hello world')}>
        Click
      </button>
    </div>
  );
};

export default App;
Source by bobbyhadz.com #
 
PREVIOUS NEXT
Tagged: #react #onclick #event
ADD COMMENT
Topic
Name
8+2 =