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:
It doesn't look like the styling is being added. What am I doing wrong?
Add import "bootstrap/dist/css/bootstrap.css"; in your index.js
In your react application, open index.js file and add import 'bootstrap/dist/css/bootstrap.css';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With