인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

dlaeogh85728517's profile image
dlaeogh85728517

asked

[React Part 1] Learning React by making and comparing

super.show()에 대해 질문드립니다

Written on

·

181

0

show(value = "") {
this.inputElement.value = value;
this.showResetButton(this.inputElement.value.length > 0);

super.show();
}

안녕하세요! 강의 너무 잘듣고 있습니다.

여기서 super.show()를 주석처리해도 똑같이 렌더링되던데, 왜 다시 show()를 호출해야하나요??

super.show()의 역할이 궁금합니다!

MVCreact

Answer 1

0

jeonghwan님의 프로필 이미지
jeonghwan
Instructor

네 결과적으로는 같습니다. 

부모 클래스인 View를 보면 show와 더불어 hide 메소드가 있는데요. 뷰를 사용하는 측에서 이 두 함수를 이용해 화면에 보이고/숨기는 기능을 합니다. show는 안보이는 뷰를 보이게 하는 것이기 때문에 부모의 메소드를 호출해 준 것입니다. 어디선가 hide로 숨겼을지도 모르니까요. 

dlaeogh85728517's profile image
dlaeogh85728517

asked

Ask a question