Programming/React
checkpoints in react
쌩우
2019. 6. 14. 19:38
리액트란 무엇인가?
: Javascript의 라이브러리로써, 선언적인 component와 재사용 가능한 component를 기반으로 구축된다.
JSX에서 Javscript의 변수 name이라는 것을 사용하려면?
: <h1>Hello, {name}</h1>
props란?
: props 원소의 이름을 특정지을 수 있다.
state의 특징은?
: 자신이 아닌 다른 컴포넌트의 state는 알 수 없다. 만약 다른 컴포넌트의 state에 뭔가 영향을 주고 싶다면, 부모 컴포넌트까지 가서 setState 시킨 값을 내려주어야 한다. 급할수록 돌아가야 한다!
functional component와 비교하여 class component의 차이점은?
- Life Cycle API를 사용할 수 있다.
- state를 가진다.
- React.Component로부터 상속받는다.
Life Cycle의 method들로는 무엇이 있는가?
- componentDidMount
- componentDidUpdate
- componentWillUnmount
- render
state가 변경되는 불리는 Life Cycle method는?
: componentDidUpdate, render
render method 내에서 setState method를 실행시키면?
: Stack overflow error 발생!!!