-
[react] DeepDive 2 리액트란?react 2023. 12. 16. 23:18
리액트는 컴포넌트들로 이루어진 결정체로 볼 수 있다.
컴포넌트란?
사용자 인터페이스에 있는 재사용가능한 구성 요소
JSX란?
자바스크립트안에 있는 HTML
컴포지션이란?
작은 구성요소부터 시작해서 사용자 인터페이스를 구축하는 방식.
const Card = (props) => { const classes = "card " + props.className; return <div className={classes}>{props.children}</div>; }; export default Card;
=> props.className : 사용자 지정 외부의 props에 대한 클래스를 불러와 card와 합하여 두개의 클래스를 적용해줌
=> props.children : children은 예약어로 card로 감싸진 사용자 지정 컴포넌트가 표시 될 수 있게 해줌.
리액트 공식문서 보러가기
https://ko.legacy.reactjs.org/docs/components-and-props.html
Components와 Props – React
A JavaScript library for building user interfaces
ko.legacy.reactjs.org
'react' 카테고리의 다른 글
[react] DeepDive 4 리액트 state (0) 2023.12.17 [react] DeepDive 3 리액트 User Interaction & State (1) 2023.12.17 [react] DeepDive 1 +[JS] (1) 2023.12.15 파일저장하기 (0) 2023.11.20 [React] 내가 보려고 쓴 개발환경 셋팅하기 (0) 2023.11.17