React JS fundamentals Course (2019 Update!)
mounting 태어나는 것
마운팅은 constructor() > render() > componentDidMount() 가 실행되면서 컴포넌트가 시작됨.
updating 업데이트 되는 것
내가 뭔가를 클릭하면 상태변화가 일어나는데 이걸 업데이트라고 함
클릭 > render() 랜더링 > componentDidUpdate()
이렇게 실행되면서 업데이트가 완료 됨.
unmounting 컴포넌트(component)가 죽는 것을 의미함
그게 컴포넌트가 돔에서 제거 될 때를 의미
componentWillUnmount()
js 시간 지연 함수, 일정 시간 뒤 실행시키는 것.
setTimeout(function() { // Code here }, delay);
npm i axios 하고 import axios
{data: {data: { movies },},} 이것은 data.data.movies와 같다.
함수가 끝나고 나는 걸 확인하려고 async await를 사용함.
1. 데이터 가져옴(axios 함).
2. 그것을 setState로 상태에 있는 영화 배열에 추가하였고,
3. 데이터를 가져오는 것이 완료되면 로딩이 완료 준비됨이라는 표시로 만듬.
const {isLoading} = this.state로 표현
const {isLoading, movies} = this.state;
그래서 movies.map() === this.state.movies array에 map() 함수를 실행한다는 의미.
<Movie /> 이것이 componentES6 => 함수에 익숙해질 필요가 있겠다.