FE/React

React의 LifeCycle
LifeCycle method는 React component의 생성부터 소멸까지 일련의 이벤트들이라고 할 수 있다. 리액트의 모든 이벤트는 lifecycle을 지난다. 1. Mounting 2. Updating 3. Unmounting 1. Mounting - 컴포넌트가 생성될 때, 다음과 같은 순서대로 호출된다. constructor() static getDerivedStateFromProps() render() componentDidMount() constructor() - React component의 constructor()는 컴포넌트가 마운트되기 전에 호출된다. 보통 개체를 this.state에 할당하여 로컬 상태를 초기화하거나, 인스턴스에 이벤트 처리기 메소드를 바인딩할 때 사용한다. 그리고 ..