Chapter 4-2 LifeCycle
공부한 내용을 기록 및 정리를 위한 글로 더 정확하고 많은 정보를 원하시면 맨 아래 링크를 참고해주세요. 1. 컴포넌트가 로딩되기 시작하는 Mount(생성)constructorclass ClassComponent extends Component { state = { value: 0 }; constructor(props) { console.log("[class] constructor"); super(props); this.state = { value: 0 }; }constructor는 클래스 생성자로 state의 초기 상태를 지정해줍니다.위 형태와 같이 super(props)를 해주어야 합니다.super(props)를 호출하지 않으면 this를 사용할 수 없고, this.state나 ..
2025.03.03