Used to describe & create HTML elements in JavaScript in a declarative way
JSX와 React는 서로 다른 별개의 개념
종종 함께 사용되기도 하지만 독립적으로 사용할 수 있다.
JSX는 확장된 문법이고, React는 JavaScript 라이브러리입니다.
React projects come with a build process that transfomrs JSX code(behind the scenes) to code that does work in browsers
React Components = Function
Component Functions Must Follow Two Rules
Name starts With Uppercase Charactermust start with an uppercase characterMulti-word names should be written in PascalCase (e.g., "MyHeader")recommended to pick a name that describes the building blocksReturns Renderable Contentsreturn a value that can be rendered by Reactmost cases : Return JSXJSX 작성규칙
1. 하나의 루트 엘리먼트로 반환하기
2. 모든 태그는 닫아주기
<img>처럼 자체적으로 닫아주는 태그는 반드시 <img /> 형태로 작성해야 함<li>oranges와 같은 래핑 태그도 <li>oranges</li> 형태로 작성해야 함3. 거의 대부분 캐멀 케이스로!
❗ 이것이 바로 React에서 HTML과 SVG의 어트리뷰트 대부분이 캐멀 케이스로 작성되는 이유입니다.
예를 들어,
stroke-width 대신 strokeWidth로 사용class는 예약어이기 때문에, React에서는 DOM의 프로퍼티의 이름을 따서 className으로 대신 작성