목록eventhandler (1)
🤍 은지log 🤍
[REACT] 이벤트 핸들러 ( Event handler )
onChange, Click, KeyPress import { useState } from 'react' const EventPractice = () => { const [message, setMessage] = useState('') const handleClick = () => { alert(message) } const handleKeyPress = (e) => { if (e.key === 'Enter') { alert(message) } } return ( 이벤트 연습 { setMessage(e.target.value) }} onKeyPress={handleKeyPress} /> 확인 ) } export default EventPractice import { useState } from 'reac..
💙 React
2022. 10. 7. 17:44