Debugging ReactJs in Chrome on page load is and everything else undefined when using the console

I have a problem while debugging React while loading the start page. As you can see from the screenshot, if I am over this

I can see the content, but if I use the console it says there this

is undefined. This only happens when I reload the page, if I debug on click this problem does not occur. I have it installed React Developer Tools

for Chrome and noted that when this happens it only speaks Connecting to React…

. Could this be the problem?

https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en

I'm using .tsx

files ( .jsx

but with TypeScript) if that might make a difference.

Sources tab:

enter image description here

Reaction Tab:

enter image description here

+3


source to share


1 answer


Based on your updated comments, if you run your function from the constructor and then stop it with a breakpoint, the constructor will not complete execution, which means it won't be able to set the prototype chain correctly and most importantly, set the correct reference to this

.



0


source







All Articles