Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- react typescript
- CSS
- bootstrap
- nextjs 설치
- react
- fetch
- styled components
- github
- nextjs .env
- typescript react
- npm styled-reset
- github io
- 컨디셔널 렌더링
- ngrok설치
- dart 변수
- createGlobalStyle
- next.js css
- There isn’t anything to compare
- ngrok실행
- rewrites
- nextjs
- SCSS
- icon
- API token
- input type=file
- Git
- react env
- API 토큰
- getModifierState
- git lab
Archives
- Today
- Total
꾸준히 성장하는 개발자
React with Typescript 설치 본문
https://create-react-app.dev/docs/adding-typescript/
Adding TypeScript | Create React App
Note: this feature is available with react-scripts@2.1.0 and higher.
create-react-app.dev
TypeScript를 함께하는 React프로젝트를 설치하고 사용해보자
리액트를 하면서 TypeScript를 함께 진행할 때 함께 설치를 진행해준다
npx create-react-app my-app --template typescript
만약 기존 React 프로젝트에 추가로 TypeScript를 추가한다면 아래 명령어를 적어준다
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
react에서 사용하던 파일형식이던 jsx가 아닌 typescript를 함께 사용하는 tsx형식을 사용한다.
만약 기존 프로젝트에 진행하는거라면 파일 확장자를 tsx로 바꿔준다
기존에 React프로젝트에서 styled-component를사용중이라면 에러 메시지가 뜰 것이다
npm i --save-dev @types/styled-components
설치하고 다시 보면 styled-components에서 에러 메시지가 멈추는 것을 볼 수 있을 것이다.
'React' 카테고리의 다른 글
[React] React state 비동기성 (0) | 2022.05.20 |
---|---|
[React 라이브러리] 상태 관리 라이브러리 Redux (0) | 2022.05.20 |
[React] API를 이용한 data 가져오기 (0) | 2022.05.12 |
React - jsx , state, props (0) | 2022.05.06 |
[React] React.memo() (0) | 2022.05.04 |