DEV Community

Cover image for Trick for React Debugging
Isaque Igor
Isaque Igor

Posted on

Trick for React Debugging

Do you want to see what's actually coming in from the props?

The JSON.stringify() creates a JSON string out of the props and you will see everything that's coming in from the routes.

Alt Text

The third argument of JSON.stringify(data, replacer, space) is the number of spaces to use for pretty formatting. That means, if you set 4 as your space parameter, the result would be more indented.

You will see something like this, on your page:

{
  "name": "Isaque Igor",
  "id": 1,
  "email" : "email@email.com",
  "roles": {
      "isDeveloper": true,
      "isAdmin": true
  }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)