【问题标题】:There is no style applied when using Reactstrap with Parcel将 Reactstrap 与 Parcel 一起使用时没有应用样式
【发布时间】:2020-06-27 16:35:48
【问题描述】:

我正在使用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)。结果如下:

parcelreactstrap 有什么问题?我怎样才能摆脱这个问题?

【问题讨论】:

    标签: javascript reactjs reactstrap parceljs


    【解决方案1】:

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

    安装bootstrap包:

    npm install --save bootstrap
    

    bootstrap.min.css 添加到您的index.js 文件中:

    import 'bootstrap/dist/css/bootstrap.min.css';
    

    【讨论】:

    • 非常感谢!我以为reactstrap 已经包含了bootstrap
    猜你喜欢
    • 2018-10-04
    • 1970-01-01
    • 2017-06-29
    • 2018-06-24
    • 1970-01-01
    • 2021-10-03
    • 2022-11-22
    • 2013-10-08
    • 2014-10-08
    相关资源
    最近更新 更多