【发布时间】:2016-11-15 11:33:07
【问题描述】:
我正在尝试将 masonry.js 集成到 react.js 中,但我遇到了设计问题。
我是否应该将所有砌体块都放在一个根反应组件中,就像它在 react-masonry-component 中所做的那样
<RootComponent>
this.props.elements.map(function(element){
return (
<li className="image-element-class">
<img src={element.src} />
</li>
);
});
<RootComponent>
或者我应该将每个砌体块作为一个新的 React 组件作为根 React 组件的子组件?
<RootComponent>
this.props.elements.map(function(element){
return (
<ChildComponent props={element}>
);
});
<RootComponent>
【问题讨论】:
-
为什么不使用 react-masonry-component
标签: reactjs jquery-masonry react-masonry