LoginSignup
3
4

More than 5 years have passed since last update.

create-react-appコマンドを使ってReact-Bootstrapを導入

Last updated at Posted at 2016-07-29

Facebook公式のcreate-react-appコマンドを使ってReact.jsアプリを爆速で作成するを見て、少し試した。React-Bootstrapの導入まで軽く試してみた。

環境

ローカル環境:Windows10
ターミナル:GitBash + ConEmu

Qiitaの記事通りHello-Worldまで

Terminal
npm install -g create-react-app
create-react-app hello-world
npm start
2016-07-29.png ターミナルで上記のコマンド実行で、この画面まで。

Hello-World以降

React-Bootstrap Getting started通りに導入

1.Terminal
npm install react-bootstrap --save
2.Terminal
bower install react react-bootstrap

bash: bower: command not found

2のコマンド実行時に、上記のエラーがでる。以下のコマンド実行し、再度2を実行。

3.Terminal
npm install -gf bower

App.jsで試しにButtonを読み込んでみる。

App.js
import { Button } from 'react-bootstrap';
~~以下のコードをdivタグ内に記述
<Button className="btn-github" >View Code</Button>

index.htmlでbootstrap.cssを読み込む。

index.html
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css"> ->追加
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css"> ->追加

bootstrapのボタンが表示される。
button.png

##その他参考
bower command not found windows

3
4
0

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
3
4