RN(React-Native) 시작하기 2 - Android

kwlee·2021년 6월 24일
0

RN(React-Native)

목록 보기
2/9

react-native 프로젝트 생성

react-native 생성

react-native init test

yarn 설치

npm install -g yarn

react-native 시작

cd test
yarn android

오작동시

react-native doctor

  1. SDK 못찾을 경우 Android SDK Command-line Tools 설치

기다리면 화면 나옴

TypeScript 설정

TypeScript에 필요한 라이브러리 설치

TypeScript가 동작할 수 있도록 필요한 라이브러리을 설치합니다.

npm install typescript @types/react @types/react-native --save-dev

typescript: TypeScript
@types/react: 필요한 react의 type
@types/react-native: 필요한 react-native의 type

TypeScript Setting

tsconfig.json 생성
프로젝트 폴더에 tsconfig.json파일을 생성후 내용을 삽입

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "jsx": "react",
    "lib": ["es6", "es2017"],
    "moduleResolution": "node",
    "noEmit": true,
    "strict": true,
    "target": "esnext",
    "skipLibCheck": true
  },
  "exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
}

TypeScript - tsconfig.json
TypeScript - compile options

profile
안녕하세요.

0개의 댓글