• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 React 게시판 Warning: A component is changing an uncontrolled input to be controlled.

Warning: A component is changing an uncontrolled input to be controlled.

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #75279

    노지원
    참가자
    인풋 요소에서 onChange를 기입하지 않으면 제목과 같이 이런 경고 메시지가 뜹니다.
    A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
    
    이런 경고가 떴을 때 value 대신 defaultValue를 주거나, readOnly 속성을 주거나, onChange를 기입하면 문제가 해결되던데요,
    
    경고는 해결할 수 있지만, 왜 이런 경고가 뜨는 건가요?
    #75280

    노지원
    참가자
    그리고 checked에 이런 경고도 뜨는데, Warning: You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`
    
    제목에 적은 경고도 그렇고 댓글의 경고도 무슨 원인에서 이런 게 뜨는지 궁금합니다.
    #75318

    codingapple
    키 마스터
    인풋에 기능개발하고싶으면 onChange쓰라고 권장하는 메세지일 뿐입니다
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관, 개인정보처리방침
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠