React로 공부한지 4일째 컴포넌트를 배우고 있는데
#1번
#2번
1번과 2번의 차이가 궁금했다. 2번은 화살표 함수로 만든 함수형 컴포넌트라는 것 까진 알겠는데 1번은 변수인 것인가.. 뭔가 싶었다. 그래서 구글링 하다가
기술면접 준비하기-3
Element와 Component의 차이점은 무엇인가요? Element Component instance 또는 DOM 노드 및 원하는 속성을 설명하는 일반 객체입니다. 실제 instance가 아닙니다. 화면에서 보고 싶은 것을 React에게 알려주는 일
velog.io
이 글을 읽어봤는데
1번의 정체는 Element였다!
Element는 태그를 지정하는 객체이고, 불변한다. 우리가 화면에서 보는 것을 얘기한다.
Component는 props로 입력을 받을 수 있고 Element를 반환하는 함수 혹은 클래스를 얘기한다. 또한 state도 가질 수 있다!
더 참고하면 좋은
https://reactjs.org/docs/glossary.html#elements
Glossary of React Terms – React
A JavaScript library for building user interfaces
reactjs.org
https://reactjs.org/docs/components-and-props.html
Components and Props – React
A JavaScript library for building user interfaces
reactjs.org
https://sambalim.tistory.com/117
React Element와 Component 차이
<!doctype html> Difference_element_component_inReact What is the difference between an element and a component in React? React에서 Element와 Component의 차이는 무엇입니까? 나의 답변 Element 는 React..
sambalim.tistory.com
'React > 용어정리' 카테고리의 다른 글
[용어정리] DOM (0) | 2022.03.17 |
---|
댓글