[英]react.js change parent width based on child
I have created a NavigationBar
component using react-bootstrap
, so that I can use that over and over in my project.我使用
react-bootstrap
创建了一个NavigationBar
组件,以便我可以在我的项目中反复使用它。
NavigationBar
: NavigationBar
:
<div>
<NotificationContainer />
<Navbar bg="dark" variant="dark">
<Navbar.Brand href="/home">Local File Server</Navbar.Brand>
<Navbar.Collapse className="justify-content-end" />
<Form inline>
<FormControl type="text" placeholder="Search" className=" mr-sm-2" />
<Button type="submit">Search</Button>
<Button variant="danger" type="submit" href="/upload">
Upload
</Button>
</Form>
</Navbar>
</div>;
Which works fine :哪个工作正常:
Until, table gets populated and horizontal scrollbar appears.直到,表格被填充并出现水平滚动条。 Then I miss the complete navigation bar, like this :
然后我想念完整的导航栏,如下所示:
How can I resolve this ?我该如何解决这个问题?
components : https://github.com/maifeeulasad/Local-File-Server/tree/master/local_file_server/src/component组件: https : //github.com/maifeeulasad/Local-File-Server/tree/master/local_file_server/src/component
我认为向 Table props 添加“响应式”是最简单的解决方法
<Table striped bordered hover responsive>
我从互联网上找到了一种方法,通过将回调函数作为道具传递给孩子。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.