In the React JS app I want to loop my state and return JSX
But when I use this showing the below error.
State
cart ={}
in console
Code
this.state.cart.map((item1)=>{
console.log(item1)
})
*error
Uncaught TypeError: this.state.cart.map is not a function
Basically, I want the loop for below JSX
the title is Saree Blouse and Its quantity is 1

cartarray isn't valid, you should be seeing a syntax error. Please also make sure the example is a minimal reproducible exampleconsole.log(this.state.cart)showing the same result as I mention abovecartis not an array, but an object. Object's don't have amapmethod. Use an array instead.