Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 473
Yiman Kaing Avatar asked Apr 25 '16 14:04

Yiman Kaing


2 Answers

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

like image 160
Will Avatar answered Sep 23 '22 18:09

Will


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

like image 26
ChaosPredictor Avatar answered Sep 21 '22 18:09

ChaosPredictor