Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
How di i fix Uncaught TypeError: Cannot read properties of undefined (reading 'map') in react

This code throws the above-mentioned error. I tried destructuring the array too but it displays some other error tried every possible way to fix it but failed. Any help will be appreciated.

import React, { Component } from "react";
import Shop_Data_List from "./shopData";
import ShopPreview from "./shopPreview";

class Shop extends Component {

    constructor(props) {
        super(props);

        this.state = {
            collections: Shop_Data_List
        };
    }

render(){
    const {collections} = this.state;
    return(
        <div>
            <h1>Shop Is Open</h1>
            <div>
                {
                    collections.map(({id, title, items}) => (
                      <ShopPreview key={id}  />  
                    ))
                }
            </div>

        </div>
    );
}
}




const ShopPreview = ({title, items}) => {
    <div className="Wrapper"> 
        <div className="title">Title</div>
        <div className="lreview">
            {items.map((item) =>(<div key={item.id}>{item.name}</div>))}
        </div>
    </div>
}

export default ShopPreview;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!