Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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>
  )
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: select element in js 
Javascript :: javascript array to csv string 
Javascript :: jest check binary 
Javascript :: communication with service worker 
Javascript :: how to move an image with arrow keys in javascript 
Javascript :: take only int part of number js 
Javascript :: string reduction javascript 
Javascript :: get method 
Javascript :: How i can use “LIKE” operator in mongoose 
Javascript :: javascript console input 
Javascript :: react open a link to an outside siite 
Javascript :: remove duplicate value from map react js 
Javascript :: python json to csv 
Javascript :: made clickable url in js 
Javascript :: how to make a plinko game using javascript 
Javascript :: switch browser to fullscreen 
Javascript :: node-schedule-tz print jobs 
Javascript :: localstorage drop item 
Javascript :: create paragraphs with js in html 
Javascript :: angular date input value 
Javascript :: Convert JS date time to SQLSERVER datetime 
Javascript :: Javascript remove array item by value 
Javascript :: sinha crud template 
Javascript :: Introdução ao nodeJs 
Javascript :: generate secret key js Java Script 
Javascript :: Codewars Find the smallest integer in the array 
Javascript :: javascript calculate days between dates 
Javascript :: custom error nodejs 
Javascript :: generate random brightest color 
Javascript :: js take last item in array 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =