Why is my data not showing

Hi folks,

I have a simple React app and I am trying to map through the data but it is not showing.

Here is a sandbox:

I have read this: https://reactjs.org/docs/lists-and-keys.html but I can not get it to work.

What am I doing wrong here?
Cheers,
John!

You have couple issues:

  1. todos is not defined, as you can see in error message. todos is one of the properties of your state and must be accessed like this: this.state.todos.
  2. Your JSON test file is not JSON, you can learn a bit more about it here:
    https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON
1 Like

How can I make it so it is defined please? Where can I learn this? I am stuck! Thank you!

How about define it?

const { todos } = this.state;
1 Like

Thank you so much this solved it :slight_smile: