I want to add 4 objects the same as in array which should count. How to do so that in localstorage I will have 4 objects with the same properties?
componentDidMount(){
const productData = [
{
productImg: JSON.parse(this.props.data.getProduct.mediaUrl).images[0],
productPrice: this.props.data.getProduct.minimalPrice,
productName: this.props.data.getProduct.name,
productOID: this.props.data.getProduct.oid
}
]
localStorage.setItem('looked-recently', JSON.stringify(productData))
}
productData = [{product1:{info: 1}, product2: {info:2} }]