【问题标题】:How can I get bootstrap classes to work in reactjs app?如何让引导类在 reactjs 应用程序中工作?
【发布时间】:2017-03-30 05:10:33
【问题描述】:

我已经 npminstalled bootstrap-sass "^3.3.7" 和 reactjs。这是否足以与诸如“好”之类的 BS 类一起使用?

这是我的组件的一部分:

render() {
    return (
        <div className="well">
            hi from well

            <button className="btn btn-danger"></button>
        </div>
    );
}

如何在我的 sass 构建中包含引导样式?

【问题讨论】:

  • 你试过 react-bootstrap 吗? react-bootstrap.github.io/getting-started.html。否则,如果您的 npm 文件中包含 bootstrap-sass,我认为您当前的代码将起作用。如果一切都失败了,您还可以使用引导 cdn 链接,您的代码应该可以工作。
  • 如何将 reactbootstrap 包含到 sass 中?

标签: twitter-bootstrap reactjs sass gulp-sass


【解决方案1】:

有两种方法可以做到这一点:-

  • 使用React Bootstrap。但它清楚地表明这个项目正在开发中,所以我认为在生产中使用它显然不是一个好主意。
  • 将 bootstrap 添加到您的项目中,并在您编译的 bundle.js 来自 react 之前将 bootstrap js 文件导入您的 html 中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-23
    • 2018-03-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多