개발/react
react에서 입력값을 받고 싶은 경우!!
발명가H
2022. 9. 24. 23:01
react에서 입력폼에 값을 받고 싶은 경우
동일하게 <input>태그를 만들어주고
value = {minutes} 로 UI에 값이 표시되게 해주고
onChange = {onChange} 라는 이벤트 리스너를 property로 추가한 다음
function App(){
const [minutes, setMinutes] = React.useState()
const onChange = (event) => {
setMinutes(event.target.value)
}