Javascript React引导转盘显示在网格中

Javascript React引导转盘显示在网格中,javascript,css,twitter-bootstrap,reactjs,Javascript,Css,Twitter Bootstrap,Reactjs,因此,我从服务器获取数据(图像),并使用页面上的引导转盘呈现它们。但是,当我渲染图像时,旋转木马堆叠在彼此的顶部,不会水平分布在页面上,而是垂直分布。我想知道为什么?也许是我的Columns引导布局之类的?还是将样式传递给对象,使其显示为like和inline block?有没有办法让它们像网格一样水平分布 const ImageCarousel = React.createClass({ getInitialState(){ return null }, componentWillMou

因此,我从服务器获取数据(图像),并使用页面上的引导转盘呈现它们。但是,当我渲染图像时,旋转木马堆叠在彼此的顶部,不会水平分布在页面上,而是垂直分布。我想知道为什么?也许是我的Columns引导布局之类的?还是将样式传递给对象,使其显示为like和inline block?有没有办法让它们像网格一样水平分布

const ImageCarousel = React.createClass({

getInitialState(){
 return null
},

componentWillMount() {
  this.props.fetchDiscovery()
},

renderImages(images) {
  var output = images.map((image) => {
    return(
        <CarouselItem >
          <img wdith={900} height={500} style={style.carousel} src={image.url} />
          <h3>Heya world</h3>
          <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
        </CarouselItem>

      )
    });
  return (
    <Col md={4}>
      <Carousel>
        {output}
      </Carousel>
      </Col>
  )

},

 renderData(item) {    

     return (
     <div>
      <Grid>
        <Row>
          {item.content.userData.firstName}
          {this.renderImages(item.content.medias)}
        </Row>
     </Grid>
     </div>
     )
},

  render () {
    return (
      <div>
        {this.props.discover.map(this.renderData)}
      </div>
    )
  }
})

var style = {};

style.carousel= {
    marginTop: '50',
    display: 'inline-block'
}

function mapStateToProps({ discover }) {
  return { discover }
}

    function mapDispatchToProps(dispatch) {
  return bindActionCreators({ fetchDiscovery },dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(ImageCarousel);
const ImageCarousel=React.createClass({
getInitialState(){
返回空
},
组件willmount(){
this.props.fetchDiscovery()
},
渲染(图像){
var输出=images.map((图像)=>{
返回(
合亚世界
自由精英的生命,自由的法雷特拉·奥古斯·莫利斯

) }); 返回( {output} ) }, renderData(项目){ 返回( {item.content.userData.firstName} {this.renderImages(item.content.medias)} ) }, 渲染(){ 返回( {this.props.discover.map(this.renderData)} ) } }) var style={}; 样式旋转木马={ 玛金托普:“50”, 显示:“内联块” } 函数MapStateTops({discover}){ 返回{discover} } 功能图DispatchToprops(调度){ 返回bindActionCreators({fetchDiscovery},dispatch); } 导出默认连接(mapStateToProps、mapDispatchToProps)(ImageCarousel);
我通过将旋转木马移动到其单独的组件来解决这个问题,并将数据作为道具向下传递,然后将每个旋转木马渲染到网格中

我通过将旋转木马移动到其单独的组件来解决这个问题,并将数据作为道具向下传递,然后将每个旋转木马渲染到网格中