I'm new to reactjs and trying to build a basic ui by parsing a json object.
class App extends Component {
state ={
products : []
};
render() {
return (
<div>
<Form onSubmit = {this.addNewProducts}/>
<ProductList products = {this.state.products} />
</div>
);
}
}
const ProductList =(props) => {
return(
<div>
{props.products.map(product => <Product {...product}/>)}
</div>
);
}
Trying to render some of the data from json here, which is where I'm struggling with. Tried to use Map but no luck, at least I'm not using it correctly.
const Product = (props) => {
return(
<div>
<div>
{props.pludetails}</div>
</div>
);
};
Returning JSON object:
{
"ResultCode": 0,
"ResultDescription": "Success",
"pludetails": [
{
"UPC": 490000129,
"ItemDesc": "SPRITE",
"Department": 197,
"Price1": 7.99,
}
]
}