question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Dev Tools – TypeError: Cannot read property 'constructor' of null

See original GitHub issue

I just added a conditional return to BitMidi’s Footer component so it sometimes returns null.

The React Dev Tools immediately stopped working when I did that, with the following error:

TypeError: Cannot read property 'constructor' of null
    at createReactElement (devtools.js:19)
    at createReactCompositeComponent (devtools.js:89)
    at updateReactComponent (devtools.js:144)
    at createReactCompositeComponent (devtools.js:122)
    at updateReactComponent (devtools.js:144)
    at Object.componentAdded (devtools.js:236)
    at Object.preact.options.afterMount (devtools.js:374)
    at flushMounts (preact.js:98)
    at diff (preact.js:111)
    at render (preact.js:370)

The added line is here: https://github.com/feross/bitmidi.com/blob/d1fe2d39f9a99a307a86d38bdfd265510613b00f/src/views/footer.mjs#L13

Removing this line makes the error go away. Disabling React Dev Tools also makes the error go away.

  • Preact 8.3.1
  • React Dev Tools 3.3.0

I’m sorry that this is not a small test case, but I wanted to check if anyone had any idea what’s going on here first. Is this a known bug?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ferosscommented, Aug 3, 2019

Sorry for not replying – been away from GitHub. Thanks for fixing the issue @marvinhagemeister

2reactions
pasierbcommented, Feb 9, 2019

@feross Had the same issue when using custom redirect component. Thought that instant redirect might be an issue so pushed it to next frame

componentWillMount() { setTimeout(() => { route(this.props.to, true); }, 0) }

Solved the problem for me. Hope it helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Type error cannot read properties of null even though ...
You are trying to get the state that is defined in the Main component. Move the constructor to the App component.
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
{solved} TypeError: Cannot read property 'firstname' of ...
{solved} TypeError: Cannot read property 'firstname' of undefined. I'm having like no clue whats wrong with the code.. I've checked the Q&A Forum...
Read more >
uncaught typeerror: cannot read properties of null ... - You.com
Am getting "TypeError: Cannot read properties of null (reading 'useMemo') error Redux in my react redux application. I made a very simple react...
Read more >
How to Avoid the Infamous "Cannot read properties of ... - Bitovi
As a JavaScript developer, I'm sure you've encountered the frustrating runtime TypeError Cannot read properties of undefined .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found