1 function changeBackground(e) {
2 e.target.style.background = 'red';
3 }
4
5 return (
6 <div className="App">
7 <button onMouseOver={changeBackground}>Hover over me!</button>
8 </div>
9 );
1import React from "react";
2 import "./styles.css";
3
4 export default function App() {
5
6 function MouseOver(event) {
7 event.target.style.background = 'red';
8 }
9 function MouseOut(event){
10 event.target.style.background="";
11 }
12 return (
13 <div className="App">
14 <button onMouseOver={MouseOver} onMouseOut={MouseOut}>Hover over me!</button>
15 </div>
16 );
17 }
18
1onClick onContextMenu onDoubleClick onDrag onDragEnd onDragEnter onDragExit
2onDragLeave onDragOver onDragStart onDrop onMouseDown onMouseEnter onMouseLeave
3onMouseMove onMouseOut onMouseOver onMouseUp
4