0

See the screenshot. https://i.stack.imgur.com/dsh2T.png

I am logging JSON data in my react application. But chrome dev is showing token value but when expanded it shows null. Why? And my application is also getting null value.

Future King
  • 3,819
  • 6
  • 28
  • 37
  • Definitely weird. Can you share some way we can try to reproduce this? Otherwise I don't know how anyone can help. – AskYous Mar 02 '20 at 20:24
  • Hover over the `i` and it'll tell you that the object has been re-evaluated. What you're seeing is a snapshot of the object at a particular point in time. Can you show your code? – Philip Mar 02 '20 at 20:28
  • Does this answer your question? [Weird behavior with objects & console.log](https://stackoverflow.com/questions/23429203/weird-behavior-with-objects-console-log) – Emile Bergeron Mar 02 '20 at 21:00

1 Answers1

1

But chrome dev is showing token value but when expanded it shows null. Why?

When you expand it, Chrome re-evaluates the object again to show all properties (not at the time you log it). So it is likely that your data got mutated between the time you logged the value and expanded it in the console.

You should see a small info icon next to it telling you it got re-evaluated. Reference: https://dev.to/buddylreno/expanding-objects-in-chrome-dev-tools-happens-asynchronously-3p3j

kmui2
  • 2,227
  • 18
  • 19