How to get the value of the input field in react js? If we want to get the value of input in react js, then for that we have to The state should be known so that we can get the input field in react js. If you have written javascript, html In react js the value is stored in variables but if you want to get the value of react js input field then you have to know the state only then you can get the value in react js.
import React, { useState } from 'react' function page() { const [input, setinput] = useState(); console.log(input) return ( <div> <h1>how to get value onchange in react</h1> <input className=' bg-slate-100 my-5 relative left-[44vw]' type="text" onChange={(e)=>setinput(e.target.value)} /> </div> ) } export default page