๋ชฉ๋ก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