Yiman Kaing
Yiman Kaing

Reputation: 309

bsStyle of Bootstrap React doesn't work

I have been working on boostrap react for 3 hours. I have tried to find questions and answers to my problem. bsStyle of Bootstrap React doesn't work at all, so i wonder it why? I have seen so many examples, and they just import like what i have done too.

import {Button} from 'react-bootstrap';

but i still get a simple button without any styles here my component

export class bsButton extends React.Component{
render () {
        return (
            <div>
                <Button bsStyle="primary">primary button</Button>
            </div>
        );
    }
} 

what is wrong with my import or my component code? your help is appreciated :D

Upvotes: 6

Views: 8943

Answers (2)

Will
Will

Reputation: 3044

You need to make sure you have added the bootstrap CSS in the head of your page. Getting Started This can be easily forgotten when adding the library through NPM

Upvotes: 9

ChaosPredictor
ChaosPredictor

Reputation: 4051

Include

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">

in public/index.html

  <head>
  .
  .
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
  .
  .
  </head>

source: here

Upvotes: 6

Related Questions