DEV Community

Discussion on: React TypeError: Cannot read property problem

Collapse
 
dance2die profile image
Sung M. Kim

Hi @yvens47 . Could you provide more context?

You can improve your chances for a reply by putting a minimal example to either JSFiddle, Code Sandbox, or StackBlitz. Describe what you want it to do, and things you've tried.

Collapse
 
yvens47 profile image
yvens47

here is the jsfiddle.net/67eLg9ft/3/

I made the request to the google got a response and the response in the items state of the component but when I try to access property of some of the of the objects inside the Items state.
I am getting a type error; properties undefined.

I think it has something to do with this piece of code below inside the render method.
const { items } = this.state.items ? this.state : [];

or the code inside the ComponentDidmount Method

Collapse
 
tiffany profile image
tiff

Hey! You're from my neck of the woods. Having a similar issue. Maybe I can try to track it down and help out a fellow Central Pa dev.