Skip to content

Instantly share code, notes, and snippets.

@vivek12345
Created October 16, 2017 19:36
Show Gist options
  • Save vivek12345/1cb3787185402df040a20edc783890c0 to your computer and use it in GitHub Desktop.
Save vivek12345/1cb3787185402df040a20edc783890c0 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import Product from './Product';
export default class ProductsContainer extends Component {
constructor(props) {
super(props);
this.state = {
products: [
'Red Saree',
'Blue Saree',
'Green Saree'
]
}
}
renderProducts() {
return this.state.products.map((product) => {
return <Product name={product} />;
});
}
render() {
return (
<div className='products-container'>
{this.renderProducts()}
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment