javascript - 覆盖整个宽度的反应侧边栏
问题描述
我在我的项目中使用以下侧边栏
https://reactjsexample.com/minimal-side-navigation-component-for-react/
但是,如果我制作了组件并将其导入到我的页面中,它会跨越整个页面,而其余内容则位于其下方。我有这两种方式:
return (
<>
<Sidebar />
<Router>
<Redirect path='/user-portal' to='/user-portal/dashboard' exact />
<Route path='/user-portal/Dashboard' component={Dashboard} exact />
</Router>
</>
)
和
return (
<>
<Sidebar>
<Router>
<Redirect path='/user-portal' to='/user-portal/dashboard' exact />
<Route path='/user-portal/Dashboard' component={Dashboard} exact />
</Router>
</Sidebar>
</>
)
解决方案
推荐阅读
- symfony - 会话问题 Symfony 3.4:警告:session_start():无法解码会话对象。会话已被销毁
- biztalk - 使用 XSD 导入(从另一个架构/命名空间导入类型)在 BizTalk 解决方案中重用架构?
- google-plus - 添加 JSON-LD Schema.org 后,Google+ 文章呈现不再起作用
- cabal - Cabal & Stack 从哪里获取 Hackage 包?
- javascript - 尝试在本地文件的 Firefox Web 扩展中设置 cookie 时权限被拒绝
- ruby - attr_accessor 在哪里定义?
- reactjs - 定义文件;哪个版本适合我的包裹
- r - 如何计算单元格相互匹配的数据框中的行数
- scala - 返回一个扩展特征的案例类
- angular - Angular 服务注入问题:@Injectable 不起作用,但提供者可以