npx create-react-app [폴더명] --template typescript
npx create-react-app . --template typescript //현재 폴더 안에서
tsconfig.json
파일에 "baseUrl": "src"
추가하기
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": "src" //baseUrl 추가
},
"include": [
"src"
]
}
npm install --save @types/styled-components
npm install --save @types/react,react-dom,react-router-dom
npm i styled-reset
import * as React from 'react'
import { createGlobalStyle } from 'styled-components'
import reset from 'styled-reset'
const GlobalStyle = createGlobalStyle`
${reset}
/* other styles */
`
const App = () => (
<React.Fragment>
<GlobalStyle />
<ul>
<li>li style 확인</li>
</ul>
</React.Fragment>
)
export default App
스타일 초기화 확인