Closed pvijeh closed 8 years ago
react-masonry-component does not sort it's contents, you have to provide sorted child elements.
Here is a hypothetical example where we put some child elements in descending order. I've left out any non essential details like class names etc.
For this example, props.someElementsArray contains items that are strings, eg:
props.someElementsArray
["foo", "bar", "baz"]
React.createClass({ render: function() { var children = this.props.someElementsArray .sort() .reverse() .map(function(child) { return <div>{child}</div> }); return ( <Masonry>{children}</Masonry> ); } });
The above code will render something like
<div> <div>foo</div> <div>baz</div> <div>bar</div> </div>
I'm going to close this ticket due to inactivity. Please reopen if you would like to discuss further
react-masonry-component does not sort it's contents, you have to provide sorted child elements.
Here is a hypothetical example where we put some child elements in descending order. I've left out any non essential details like class names etc.
For this example,
props.someElementsArray
contains items that are strings, eg:The above code will render something like