Answers for "react get input value on button click functional component"

1

react get input value on button click functional component

const input = props => {

let textInput = React.createRef();

function handleClick() {
  console.log(textInput.current.value);
}

return (
    <div>
      <input ref={textInput} placeholder="Type a message..." />
      <div onClick={handleClick} className="icon">
        <i className="fa fa-play" />
      </div>
    </div>
  )
}
Posted by: Guest on May-29-2020

Code answers related to "react get input value on button click functional component"

Code answers related to "Javascript"

Browse Popular Code Answers by Language