How to include bootstrap css and js in reactjs app?

后端 未结 19 1143
既然无缘
既然无缘 2020-12-04 05:07

I am newb to reactjs, I want to include bootstrap in my react app

I have installed bootstrap by npm install bootstrap --save

Now, want to load b

19条回答
  •  既然无缘
    2020-12-04 05:40

    Here is how to include latest bootstrap
    https://react-bootstrap.github.io/getting-started/introduction

    1.Install

    npm install react-bootstrap bootstrap

    1. then import to App.js import 'bootstrap/dist/css/bootstrap.min.css';

    2. Then you need to import the components that you use at your app, example If you use navbar, nav, button, form, formcontrol then import all of these like below:

    import Navbar from 'react-bootstrap/Navbar'
    import Nav from 'react-bootstrap/Nav'
    import Form from 'react-bootstrap/Form'
    import FormControl from 'react-bootstrap/FormControl'
    import Button from 'react-bootstrap/Button'
    
    
    // or less ideally
    import { Button } from 'react-bootstrap';
    
    

提交回复
热议问题