When make route it gives me "Cannot read property 'map' of undefined"

when I make map into collectionPreview component it gives me this error

I am tried to tracking the problem with no result and more confusing.

here is the code https://github.com/HaithamCa/fantasy-shopping

It is because items is undefined.

When you are calling the component, it is through a map:

this.state.collections.map(({ id, collectionProps }) =>

You are destructuring collectionProps off of the element and then spreading to to the component. But there is no such prop on your data.

1 Like

Thanks a lot, It was for the rest of props

this.state.collections.map(({ id, …collectionProps }) =>