Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

passing argument to function handler functional compoent javascript react

function MyComponent(props) {
  function handleChange(event, data){
    console.log(event.target.value);
    console.log(data)

  }
  return <button onClick={(event) => handleChange(event, 'Some Custom Value')} value='Foo'>Click</button>
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #passing #argument #function #handler #functional #compoent #javascript #react
ADD COMMENT
Topic
Name
3+6 =