Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

pass parameter to handleclick react

import React from 'react';

const ExampleComponent = () => {
  
  function sayHello(name) {
    alert(`hello, ${name}`);
  }
  
  return (
    <button onClick={() => sayHello('James')}>Greet</button>
  );
 
PREVIOUS NEXT
Tagged: #pass #parameter #handleclick #react
ADD COMMENT
Topic
Name
7+9 =