The component in which input value changed by state
import React,{useState} from "react"
function App() {
const [val,setVal]=useState("")
return (
<div className="App">
<h1>Controlled Component </h1>
<input type="text" value={val} onChange={(e)=>setVal(e.target.value)} />
<h1>{val}</h1>
</div>
);
}
export default App;
© www.thecoderjob.com. All Rights Reserved. Designed by HTML Codex