Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React: Uncaught TypeError: Cannot read property '_currentElement' of null

I'm having problem rendering a route in React. All I see is the page before React does any rendering to it, and the following error.

Mainly, I'm having trouble figuring out which component/line is causing the error, if anyone can provide some insight I'd appreciate that. Thanks.

screenshot

like image 748
Angela Avatar asked Nov 09 '22 07:11

Angela


1 Answers

Make sure you're importing all components your using inside your render() { ... } block.

This error can be thrown if you're trying to render a component that hasn't been properly imported or is returning undefined.

If this is a case you may also be seeing a related error Uncaught TypeError: inst.render is not a function.

I try to identifying which component is causing the issue by:

  • Replace jsx with simple <div>test</div> element by element
  • If I find an element / component causing it, I make sure it is impoted, then dig deeper.
  • Look at your diff and revert code / stash code

Best of luck!

like image 171
Sir.Nathan Stassen Avatar answered Nov 14 '22 22:11

Sir.Nathan Stassen