Skip to content Skip to sidebar Skip to footer

Game Of Life: Cannot Read Property 'state' Of Undefined

SITUATION: I create a few dots and click on Start. The error pops a million times (logical since there are 100 cells and a setInterval). ERROR: Uncaught TypeError: Cannot read pro

Solution 1:

I think the issue is that you're referencing state on a component, but it's not through a 'ref' to the component instance, so you won't have state. I think you'd want to look into refs. Have you tried logging what's getting passed to isAlive?

Since this seems more like a learning app than a real project, I'd advise spending more time learning React components and thinking in React before posting every bug... we're willing to help but can't do the work for you :)

Welcome to React and I wish you the best of luck!

Post a Comment for "Game Of Life: Cannot Read Property 'state' Of Undefined"