7
9

More than 3 years have passed since last update.

React-Bootstrapを使えるようにする

Last updated at Posted at 2019-12-17

初めにreactのプロジェクトを作る

npx create-react-app my-react-project



プロジェクトのroot直下に移動して

cd my-react-project



インストールして

npm install react-bootstrap bootstrap



index.htmlに以下を記載して

<link
  rel="stylesheet"
  href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
  integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
  crossorigin="anonymous"
/>



使いたい要素をインポートして使う
App.js

import React, { Component } from 'react';
import Button from 'react-bootstrap/Button';

class App extends Component {
    render() {
        return (
            <div>
                <Button> ボタンだよ </Button>
            </div>
        );
    }
}
export default App;

↓実行結果
スクリーンショット 2019-12-17 23.55.57.png

macで`の打ち方初めて知った。[ option + Shift + _ ]

参考サイト
本家

7
9
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
7
9