DEV Community

Prathamesh3
Prathamesh3

Posted on

unable to rendering the component

I am working on the t-shirt store application . In which there are Admin controls the all the categories of products and the all of the products . I created ManageProducts component which handle the updating and delating the products by the admin . When I render it without any function it works properly and displaying all of the buttons . But when I add the mapping function in it, it does not displaying buttons and the products details . Also there is no any error in console ...
Here is the code https://codeshare.io/5eEzeK
Alt Text
Please anyone help me to sort out this problem...

Top comments (1)

Collapse
 
adrfoong profile image
Adrian Foong

What is your products variable set to? You set it initially to an object {}, so I'll assume that it gets set to an object after your getProducts method. If so, map doesn't work on an object - it is an array method. And product.length > 0 will return false, so that entire div will not be rendered

Retry later
Retry later