<Container className="main-header">
<Row>
<Col sm={6}>
Some content here
</Col>
</Row>
</Container>
我没有深入研究抽象,但我的猜测是这些组件都将成为div元素。
我应该将整个内容嵌套到一个额外的语义HTML元素中吗?还是还有另一种传统的方法?
您正在寻找
as
https://reaect-bootstrap.netlify.app/docs/getting-started/introduction#as-prop-api
因此,您的代码变为:
<Container as="header" className="main-header">
<Row>
<Col sm={6}>
Some content here
</Col>
</Row>
</Container>