LifeCycle API는 컴포넌트가 브라우저에 나타날때, 사라질때, 업데이트 될때 호출되는 API를 말한다. 

 

1. constructor

  => 컴포넌트가 새로 만들어 질때 호출되는 함수 

 

2. componentWillMount

  => 컴포넌트가 화면에 출력되기 직전에 호출되는 함수. v16.3 에서는 해당 API가 deprecated 됨.

 

3. componentDidMount

  => 컴포넌트가 화면에 출력될때 호출되는 함수. 외부 라이브러리 연동 및 데이터 요청등에 주로 사용.

 

4. componentWillReceiveProps 

  => 새로운 props를 받게 되었을때 호출. 주로 state -> props에 따라 변해야 하는 로직을 작성함. 새로 받게될 props는 nextProps로 조회 가능 하며 this.props는 변경전 값임. 

 

5. componentWillUnmount

  => 등록한 이벤트 제거 및 사용한 라이브러리 dispose등 호출하는데 이용함.

'0x001 Programming > 03. React-Native' 카테고리의 다른 글

react-native-chart-kit LineChart Data 동적 변경  (0) 2020.12.09
android:usesCleartextTraffic 관련  (0) 2020.06.25
props | state  (0) 2019.04.29
React Native UI 학습  (0) 2019.03.25

+ Recent posts