Answers for "get value of input element on button click react"

1

get value of input element on button click react

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 "get value of input element on button click react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language