1

At a loss here. I've got a React component and some data. My attribute is inaccessible in the code but can be accessed in the console from the same console.log.

Any idea what causes this bug?

I've attached screenshots:

react code console

TemporaryName
  • 487
  • 5
  • 16
  • 2
    Could you share the all the code in the file and highlight where you are not able to access the variable? – T. Short Dec 23 '19 at 23:00
  • As @T.Short said, having a decent snippet would be handful, are you sure you're trying to access the property on the right part of the React lifecycle? – Zhephard Dec 23 '19 at 23:01
  • 1
    Does this answer your question? [Weird behavior with objects & console.log](https://stackoverflow.com/questions/23429203/weird-behavior-with-objects-console-log) – Emile Bergeron Dec 23 '19 at 23:02
  • It's probably that @EmileBergeron, but I'd love to get it working still. The console logging is done in the render method, which should update based on the attribute. – TemporaryName Dec 23 '19 at 23:54
  • Like others have mentioned, we need a [mcve] to help. – Emile Bergeron Dec 23 '19 at 23:55
  • Another behavior that can be observed without any debugging is the component updating based on the attribute, then it somehow updates again which removes the attribute. But it's constantly logged as undefined in the console. – TemporaryName Dec 23 '19 at 23:55
  • 1
    I'll get a reproducible example up tomorrow. – TemporaryName Dec 23 '19 at 23:55

0 Answers0