반응형
jsx
-
리액트 기본문법 JSX, state프레임워크/리액트 React 2023. 1. 14. 18:22
리액트 기본문법 리액트는 html 대신 jsx를 사용한다. class 사용 시, class 대신 className 사용 변수를 html에 사용하고 싶을 땐 {중괄호} - 데이터 바인딩 html에 style속성 넣고 싶을 때는 중괄호에 {} 자료형 사용, 속성은 - 대신 모든 단어 붙여씀 (font-size → fontSize) return 안에는 병렬로 태그 2개 이상 기입 금지 import './App.css'; // css 연결 function App() { let post = '강남 우동 맛집' //변수 선언 let data = 'red' return ( {/* class 지정(className 사용) */} 블로그 {/* 태그 내 인라인으로 속성 넣기 style = {{}}, html 태그 내 변..