Front End/React
[React] React Hooks 의 사용 이유
DevPing9_
2021. 9. 24. 15:42
# React Hooks 배포 이전
- Component 내부에 state가 있다? => Class 로 구현
- Component 내부에 state가 없다? + Life-cycle 을 사용해야 한다? => Class 로 구현
- Component 내부에 state가 없다? + Life-cycle 과 관계 없다? => function 으로 구현
* Hooks 이전에는 function component 를 stateless functional component 라 명명했었음.
# Hooks 이후
- function 으로도 state를 사용할 수 있게 됨. => 코드생산성 증가
# Reference
- https://ko.reactjs.org/docs/hooks-intro.html#gatsby-focus-wrapper
Hook의 개요 – React
A JavaScript library for building user interfaces
ko.reactjs.org
728x90