javascript - 在组件样式加载之前,在 React 头盔中加载我的样式文件
问题描述
在我的应用程序 app.js 中,出于某种原因,我在我的反应头盔中加载了引导 CSS,但在加载组件自定义样式之后加载。所以我的一些覆盖样式不起作用。如何在组件之前加载 react-helmet CSS?请帮助我
应用程序.js
import React, { Component, Suspense, lazy } from "react";
import ...mycomponents
class App extends Component {
render() {
<div>
<Helmet>
<link
type="text/css"
rel="stylesheet"
href="vendors/bootstrap/css/bootstrap.css"/>
</Helmet>
<Switch>
<Route path="/home">
<Home {...this.props} />
</Route>
</Switch>
</div>
}
}
所以需要在加载 home 组件之前加载 bootsrap.css。
解决方案
推荐阅读
- php - 如何在 laravel-5.6 中使用 call_user_func_array() 函数?
- javascript - 卸载组件
- xamarin.forms - 如何进行 WebviewRenderer IOS 外部 url 访问?
- android - 如何测试在 ios 和 android 上禁用自动备份?
- junit - 寻找具有嵌入式驱动程序的存储库单元测试的 Neo4j 示例
- coldfusion - 使用 CFSavecontent 生成 Excel 表格不会将图像写入 Excel 文件
- angular - 如何在具有静态变量的服务上使用 Jasmine 间谍?
- python - 在 OpenCV 中自动拍照
- javascript - 如何将 JSON 对象数组与作业 ID 一起插入到 MongoDB 集合中
- ocaml - 如何将 Ocaml 升级到最新版本以支持 Coq 中的 QuickChick?