What is an Event?
An event represents something that happens in the browser, such as a click, keyboard input, form submission, or pointer movement.
React Event Handlers
React uses props such as onClick, onChange, and onSubmit to connect UI events to JavaScript functions.
Important Difference
Pass the function itself instead of calling it while rendering. Use onClick={handleClick}, not onClick={handleClick()}, unless you intentionally need the function call result.
Useful Events
- onClick: Button and clickable actions.
- onChange: Input value changes.
- onSubmit: Form submission.
- onKeyDown: Keyboard input.
- onFocus: Element receives focus.