How to use useState Hook in React?
Syntax:
import { useState } from "react";
import ReactDOM from "react-dom/client";
function SignIn(){
const [ userName, setUserName ] = useState("");
return (
<>
<h1>SignIn</h1>
<input
type="text"
value={userName}
onChange={(e) => setUserName(e.target.value)}
/>
</>
)
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<SignIn/>);