-
사용할 컴포넌트 App.tsx에 적용 프로퍼티를 사용할 컴포넌트에 인터페이스를 활용한다. 인터페이스를 사용하면 컴포넌트 활용시 할당 된 변수와 데이터를 넣어줘야 한다. 실행 후 모습.
CRA 생성시 npx create-react-app my-app --template typescript 또는 yarn create react-app my-app --template typescript 로 프로젝트를 생성한다.
사용중인 React 프로젝트에 npm install --save typescript @types/node @types/react @types/react-dom @types/jest 또는 yarn add typescript @types/node @types/react @types/react-dom @types/jest 를 추가한다. 그 후 App.js를 -> App.tsx 로 변경 후 실행 한다