简体   繁体   中英

How to import ReactBootstrap to use button in react.js

I'm using babel.js, try to import ReactBootstrap like this

const { Button } = ReactBootstrap.Button;
const { ButtonGroup } = ReactBootstrap.ButtonGroup;

Error

Uncaught ReferenceError: ReactBootstrap is not defined

how to fix it?

Can you import like this way

  import { Button } from 'ReactBootstrap.Button'
  import { ButtonGroup } from 'ReactBootstrap.ButtonGroup'

You can use the following code for importing your ReactBootstrap using ES5 syntax.

const { Button } = require("ReactBootstrap.Button");
const { ButtonGroup } = require("ReactBootstrap.ButtonGroup");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM