将Reactstrap与Parcel一起使用时没有应用样式

问题描述 投票:0回答:1

我正在使用parcel捆绑我的代码,并使用reactstrap设置我的react应用的样式。我有一个例子:

import React from "react";
import { Button } from "reactstrap";

const Layout = () => {
  return (
    <>
      <header></header>
      <Button color="danger">Danger!</Button>
    </>
  );
};

export default Layout;

这应该创建一个漂亮的红色按钮。但是,当我使用parcel(在开发人员模式下)运行该应用程序时,它给了我一个普通按钮,但是该按钮上应用了classnamebtn btn-danger)。结果如下:

enter image description here

parcelreactstrap怎么了?我如何摆脱这个问题?

javascript reactjs reactstrap parceljs
1个回答
0
投票

您必须安装bootstrap软件包,然后在bootstrap文件中添加bootstrap.min.css

安装index.js软件包:

bootstrap

bootstrap添加到npm install --save bootstrap 文件:

bootstrap.min.css
© www.soinside.com 2019 - 2024. All rights reserved.