dropWizard
dropWizard

Reputation: 3538

react-bootstrap not working as expected

I am trying to use react-bootstrap to style a web page.

package.json

{
  "name": "chrome-ui",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.0.0",
    "react-dom": "^16.0.0",
    "react-scripts": "1.0.16"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "devDependencies": {
    "react-bootstrap": "^0.31.5"
  }
}

App.js

import React from 'react';
import { Button } from 'react-bootstrap'

function CheckState(props){
    function handleClick(e){
        console.log(props.state)
    }
    return(
        <Button bsStyle="primary" onClick={handleClick}>Click for state</Button>
    )
}

However this is what I'm seeing on the web page when I refresh:

enter image description here

It doesn't look like the styling is being added. What am I doing wrong?

Upvotes: 5

Views: 9893

Answers (2)

Nayanajith
Nayanajith

Reputation: 635

Add import "bootstrap/dist/css/bootstrap.css"; in your index.js

Upvotes: 18

Victor Bruce
Victor Bruce

Reputation: 207

In your react application, open index.js file and add import 'bootstrap/dist/css/bootstrap.css';

Upvotes: 3

Related Questions