Skip to content

TypeError: Cannot read property 'map' of undefined #179

@bryar323

Description

@bryar323

my issues:
TypeError: Cannot read property 'map' of undefined

my code:

`import React, { Component } from "react";
import Product from "./Product";
import Title from "./Title";
import { storeProducts } from "../data";
import { ProductConsumer } from "../context";
export default class ProductList extends Component {
state = {
products: storeProducts
};

render() {
return (
<React.Fragment>



<Title name="our" title="products" />

        <div className="row">
          <ProductConsumer>
            {value => {
              return value.products.map(product => {
                return <Product key={product} product={product} />;
              });
            }}
          </ProductConsumer>
        </div>
      </div>
    </div>
  </React.Fragment>

  //
);

}
}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions