eiriklv / react-masonry-component

A React.js component for using @desandro's Masonry
MIT License
1.43k stars 145 forks source link

Calling the function requires a slightly different implementation. #140

Open dylannirvana opened 5 years ago

dylannirvana commented 5 years ago

The pattern I am using is different. I am holding the array object in state. Close, but I am not sure how exactly to do this.

            return  this.state.data.length > 1 
               ? this.state.data.map((item) => (
                   <Card key={item.sku} >
                        <CardImg src={item.image} />
                        <CardTitle> {item.sku} </CardTitle>
                        <CardBody> {item.name} </CardBody>
                        </Card>
               )) 
               : null         
        }

And I am using it by calling the function (not a parameter).


                                <Row className="grid" > {this.renderData()} </Row> 
                        </Container>```
afram commented 5 years ago

I'm not sure what your question is sorry. Can you provide more context please?