react 프로젝트 생성

npx create-react-app 프로젝트명 --template typescript

기본적으로 잡다한 것들이 많이 생기는데
App.tsx
index.tsx
기본적인 세팅만 하도록 두 개 파일만 남기고 다 지워도 된다!
위의 파일도 최소 데이터만 남긴 후 모두 지우고 시작하도록 하자!

App.tsx

function App() {
  return null;
}

export default App;

index.tsx

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

styled-components 설치

npm i --save-dev @types/styled-components
npm i styled-components

+ Recent posts