Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda