Events and Forms

Harry · 22 Sep 2026 · 1 views
Log in to track your progress and mark lessons complete.

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.
Share this post:

Comments (0)

Please login or register to comment.

Create a free account to keep reading

You've enjoyed a free tutorial! Register (it's free) to unlock every tutorial, track your progress and save code.

or sign in with your account

Already have an account? Log in