Answers for "pass parameter to handleclick react"

5

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;
Posted by: Guest on September-11-2020
0

pass parameter to handleclick react

import React from 'react';

const ExampleComponent = () => {
  
  function sayHello(name) {
    alert(`hello, ${name}`);
  }
  
  return (
    <button onClick={() => sayHello('James')}>Greet</button>
  );
Posted by: Guest on September-19-2021

Code answers related to "pass parameter to handleclick react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language