리액트네이티브
[react-native] EXPO로 시작해보기 8 - 리액트 라이프사이클
알찬 퍼블리셔
2019. 8. 2. 11:33
728x90
반응형
리액트가 render 되는 함수 순서 ( 라이프 사이클 )
componentWillMount(){
//컴포넌트가 존재한다면 제일먼저 호출
//보통 API 호출하는 위치
}
render(){
//componentWillMount 다음으로 호출
//컴포넌트가 화면에 배치됨
}
componentDidMount(){
//render 다음으로 호출
//성공적으로 리액트에 컴포넌트가 전달되면 실행됨
}
업데이트 라이프사이클
componentWillReceiveProps(){
//새로운 props 를받음
}
shouleComponentUpdate(){
//새로운 props 이전과 다르면 호출
}
componentWillUpdate(){
//컴포턴트가 업데이트됨
//로딩중 아이콘이 뜨는 시점
}
render(){
//업데이트된 내용이 리액트에 적용
}
componentDidUpdate(){
//업데이트 완료됨
//로딩중 아이콘 종료 시점
}
728x90
반응형