LoginSignup
10

More than 5 years have passed since last update.

react + Material-UIの構築で多分一番簡単な方法

Last updated at Posted at 2017-01-25

React環境構築

いろんな記事を見たけどES2015じゃなかったり、自分向けにカスタムされてたりした。

create-react-app

公式のこれを使うのが早い。
https://github.com/facebookincubator/create-react-app
上記のREADMEに書かれている通り下記コマンドでインストールが完了する

npm install -g create-react-app

Appの作成

create-react-app my-app

で完了する。React,ReactDOMはdependencyに入っている。devDependencyにあるreact-scriptの配下にwebpackとかbabelとかlintとかが入ってる。

Material-UIのインストール

npm install --save material-ui

とかやっておけば完了する。

あとはApp.jsをいじれば幸せになれる。
App.test.jsがあってnpm testでtestできるのでindex.jsは最初書き換えない方がいいと思う。

Production

実際に公開するファイルは

npm run build

で簡単に作れる。これでReact+Material-UIを使ってゴリゴリjsとhtmlを書いてる現状から逃れたい!

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10