USESTATE со строкой

// usestate with string

const [name, setName] = useState('')
const onChange = (e) => {
  setName(e.target.value)
}

return (
  <>
    <form>
      <input type="text" onChange={onChange} value={name} />
  // or   <input type="text" onChange={(e) => setName(e.target.value)} value={name} />
    </form>
    <h2>{name}</h2>
  </>
);
abhi