JSX에서는 위 코드처럼 태그를 닫지 않으면 오류가 발생합니다. 다음과 같이 App.js 파일의 코드를 한번 수정해 보세요.
src/App.js
import React from 'react'; import './App.css'; function App() { const name = '리액트'; return ( <> <div className="react">{name}</div> <input> </> ); } export default App;
코드를 저장하면 개발 서버가 실행 중인 터미널에서 다음과 같은 오류가 나타날 것입니다.
Failed to compile.
./src/App.js
Line 10: Parsing error: Unterminated JSX contents
8 | <div class="react">{name}</div>
9 | <input>
> 10 | </>
| ^
11 | );
12 | }
13 |