how to pass button text on click in react code example
Example: 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>
);
};