react 에서는 onMouseOver 이벤트도 camelCase 형식의 명칭을 사용한다
onMouseOver 이벤트는 특정 tag 영역 안에 마우스 커서가 진입할 때 발생한다
- R069_onMouseOver.js
import { Component } from "react";
class R069_onMouseOver extends Component {
MouseOver(tag) {
console.log('TAG : ' + tag);
}
render() {
return (
<>
<div onMouseOver = {e => this.MouseOver("div")}>
<h3> DIV onMouseOver </h3>
</div>
<input type = "text" onMouseOver={e => this.MouseOver("input")}/>
<select onMouseOver={e => this.MouseOver("select")}>
<option value="react">react</option>
<option value="200">200</option>
</select>
</>
)
}
}
export default R069_onMouseOver;
- App.js
import React from 'react';
//import './App.css';
//App.css가 App.js 보다 더 한 단계 상위 폴더에 있다면
//'./..App.css'
import ReactonMouseOver from './R069_onMouseOver'
//import 'bootstrap/dist/css/bootstrap.css'
function App() {
return (
<div>
<h1>Start React 200!</h1>
<ReactonMouseOver/>
</div>
);
}
export default App;
결과

'REACT' 카테고리의 다른 글
| REACT_Key onKeyDown, onKeyPress, onKeyUp (0) | 2024.09.25 |
|---|---|
| REACT_MouseOut (0) | 2024.09.25 |
| REACT_MouseMove onMouseMove (0) | 2024.09.25 |
| REACT_Change onChange (0) | 2024.09.25 |
| REACT_Click onClick (0) | 2024.09.25 |