
ReactJS
React uses a synthetic event system that wraps browser events in a cross-browser compatible layer. This makes event handling consistent across all browsers.
function Button() {
const handleClick = (event) => {
console.log("Button clicked!", event);
};
return <button onClick={handleClick}>Click Me</button>;
}| Property | Description | Example |
|---|---|---|
| `event.target` | Element that triggered event | `event.target.value` |
| `event.type` | Type of event | `"click"`, `"change"` |
| `event.preventDefault()` | Stop default behavior | Prevent form submission |
| `event.stopPropagation()` | Stop event bubbling | Stop parent handlers |
<button onClick={handleClick}>Click</button><button onClick={(e) => handleClick(123, e)}>Click</button>this.handleClick = this.handleClick.bind(this);React supports all HTML events but uses camelCase naming:
Resources
Ojasa Mirai
Master AI-powered development skills through structured learning, real projects, and verified credentials. Whether you're upskilling your team or launching your career, we deliver the skills companies actually need.
Learn Deep • Build Real • Verify Skills • Launch Forward