So recently I decided to try and use the react-bootstrap library to make my code look simpler but for some reason the tag isn't working correctly.
I have this code with all the imports in my index.js file and the stylesheet import in my index.html
<Button variant="primary">Hello</Button>
This is what i used to create the button
I just don't get why it won't use the variant, and when I remove the variant tag it looks the same.
By default btn btn-default
class is added you need to override that class with className="btn-primary"
. This will fix your issue
<Button variant="primary" className="btn-primary">Primary</Button>
Check If you have installed Bootstrap in your node-modules.
Install it if haven't: npm install bootstrap
Use the below import on the .js file where <Button>
component is being used:
import 'bootstrap/dist/css/bootstrap.min.css';
I just faced this issue. Look for where the element is imported from. It should be imported from
import { Button } from 'react-bootstrap'
instead of
import { Button } from 'react'
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