Answers for "pass text to button component react"

0

pass text to button component react

// general component
<ButtonComponent text="General" />

 // button component
const ButtonComponent = (props) => {
  const handleClick = () => {
    console.log(props.text);
  };

  return (
    <button onClick={ handleClick }>{ props.text }</button>
  );
};
Posted by: Guest on May-01-2021

Code answers related to "pass text to button component react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language