React: Uncaught TypeError: Unable to read property '_currentElement' from null

I am having a problem rendering a route in React. All I see is the page before which React does any rendering, and the following error.

Basically, it’s hard for me to understand which component / line is causing the error, if someone can give some insight, I would appreciate it. Thanks.

screenshot

+5
source share
5 answers

Make sure you import all the components you use inside your render() { ... } block render() { ... } .

This error can be selected if you are trying to display a component that has not been correctly imported or is returned undefined .

If so, you can also see the Uncaught TypeError: inst.render is not a function related error.

I am trying to determine which component is causing the problem:

  • Replace jsx with a simple <div>test</div> element by element
  • If I find the element / component that calls it, I make sure it is tagged, then dig deeper.
  • Look at your diff and return the code / code-code

Good luck

+1
source

I had such an error when multiple instances of React required. This is for you?

0
source

I often see this after a component throws an uncaught exception from its render() method. Only the resolution we have found so far refreshes the page. πŸ˜“

The React GitHub @JosiahDaniels related issue ( # 4026 ) discusses the same behavior: "Some invariant violations leave the Reaction in an unstable state, so this is to be expected." - syranide

The issue is closed because the burden of responsibility on the author of the application does not violate the React rendering cycle with exceptions.

0
source

You may forget to export the component:

 var MyComponent = React.createClass({ ... }); module.exports = MyComponent; 

Hope this helps.

0
source

React v15 added an unstable_handleError function that can be used to fix this problem.

Basic example:

  unstable_handleError = (error) => { console.log(error) } 

Additional information: https://medium.com/@blairanderson/handle-react-errors-in-v15-4cedaae757d7#.9moxc4d3z

0
source

All Articles