Skip to content

Instantly share code, notes, and snippets.

@adeleke5140
Created May 9, 2022 08:24
Show Gist options
  • Save adeleke5140/54078efa06044aecc77e5fb4612b8a56 to your computer and use it in GitHub Desktop.
Save adeleke5140/54078efa06044aecc77e5fb4612b8a56 to your computer and use it in GitHub Desktop.
Track the value of an input with State
import React, { useState } from 'react';
const TrickInput = () => {
const [text, setText] = useState(
'try typing something'
);
const handleChange = event => {
setText(event.target.value);
};
return (
<input
type="text"
value={text}
onChange={handleChange}
/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment