Events and Forms
Harry
· 22 Sep 2026
· 1 views
Log in to track your progress and mark lessons complete.
Sponsored
React Events
Synthetic camelCase events: onClick, onChange, onSubmit. Always call e.preventDefault() in submit handlers.
Controlled Components
const [v, setV] = useState('');
<input value={v} onChange={e => setV(e.target.value)} />Validation
Validate on submit and on blur; show inline errors; disable submit until valid.
Key Points
- Controlled inputs render from state.
- Uncontrolled inputs use refs for simple cases.
- Keyboard and mouse events attach via props or document listeners with cleanup.