score:3

Accepted answer

your problem lies in the render method of your parent component. you're iterating over the productseeds array instead of your state. since you're updating the state and not the seed array react sees no reason to rerender anything and therefore nothing changes.

so if you change that line from

const productcomponents = productseed.map((product) => {...

to

const productcomponents = this.state.products.map((product) => {...

you should be fine.

moreover about your:

the line below suppose to point to the products in the state but when i highlight it, it doesn't highlight the products in the this.state.

this is just something related to the ide you're using and nothing specific about react. you're passing an object with attributes and most ides (or all (?)) don't connect the combination with this.setstate to the state object.


Related Query

More Query from same tag