'component lifecycle'에 해당되는 글 1건

  1. 2017.08.17 React.js Component LifeCycle API..
React.JS2017. 8. 17. 22:04

React.js Component의 LifeCycle API..


constructor(){


}


componentWillMount(){


}


componentDidMount(){


}


render(){


}


React.js에서 Component 처음 구성 할때(?) 실행 되는 function들이다.

실행 순서는 constructor > componentWillMount > render > componentDidMount()의 순서대로 실행된다.


constructor는 생성자 function으로 제일 처음 실행 된다. state에 기본적인 데이터를 담는것을 정의 한다.

cmoponentWillMount에서는 Component가 만들어 지기 전에 실행 된다. 실제로 사용 해본적은 없다.

render는 Component의 렌더링을 담당하는 function으로 랜더링에 필요한 React.js 태그들을 넣는다.

componentDidMount는 랜더링이 다 끝난 뒤 실행 되는 function이다. 내가 사용하는 용도는 주로 데이터를 불러와 state에 데이터를 넣는 용도로 사용중이다.


여기 까지는 Component 생성시 실행 되는 function 소개.


출처 : https://velopert.com/1130 (VELOPERT.LOG)



'React.JS' 카테고리의 다른 글

React.js "{", "}"  (0) 2017.10.16
React.js Key라는 존재..  (0) 2017.10.11
Posted by Z700zZz