Reactのプロジェクトを作成
npx create-react-app myapp --template typescript
Sassのビルドツールをインストール
npm i -D node-sass@4.14.1
node-sassのバージョン指定の理由は最新版の5.0.0をインストールすると下記のようなエラーが発生するからです
error Generating development JavaScript bundle failed
Node Sass version 5.0.0 is incompatible with ^4.0.0.
cssファイルをscssファイルにリネーム
index.cssとApp.cssを.scssに変更
index.tsxとApp.tsxのcssをimportしている箇所をscssに変更
アプリを実行
npm start
ブラウザデフォルトのcssをリセットしたい
index.sccの最初に下記を追記すればOK([公式](@import-normalize; /* bring in normalize.css styles */
))
@import-normalize; /* bring in normalize.css styles */