React-Bootstrap覆盖样式问题

时间:2020-09-19 08:30:23

标签: css reactjs sass react-bootstrap

我决定在其他单一路由中使用react-bootstrap。我只将bootstrap CSS导入了我的组件,看起来不错。但是当我去其他路线时,引导程序也会覆盖那里的样式(它会影响所有内容:段落,标题等)。如果我以另一种方式更新页面-根据我的自定义sass样式,样式会变好。是否可以使Bootstrap样式仅在一条路径上起作用而不会影响其他路由?

App.js
---
import { MyComponent } from './components/MyComponent/MyComponent';
...
<Route path="/mycomponent" render={
  () =>
  <MyComponent
     ...props
  />
} />
MyComponent.jsx
---
import React from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import './css/MyComponent.css';

我没有将Bootstrap CSS样式导入其他组件

0 个答案:

没有答案