라이프사이클, componentDidMount 연습

2021. 4. 16. 16:59개발공부/리액트 기초

- Mount = born

constructor(): 자바스크립트에서 클래스를 만들때 호출

render():

componentDidMount(): 랜더링 후

- Updating

state를 변경할때

componentDidMount() {

 

- Unmounting = component dies(change page, replace component using state..등)

componentWillUnmount()

-> when component goes away

 

 

렌더링 후 Loading...이라고 뜨고 

componentDidMount에 6초후에 isLoading:false로 바뀐다.

그러고 다시 isLoading이 False이기때문에 렌더링되면 화면은 We are ready로 바뀐다.

'개발공부 > 리액트 기초' 카테고리의 다른 글

React Hooks - useState  (0) 2021.04.16
axios api데이터 가져오기 연습  (0) 2021.04.16
[state] useState를 사용하여 state업데이트 시키기  (0) 2021.04.16
component 만들기  (0) 2021.04.16
로딩 스피너  (0) 2021.04.14