Upgrading React to 0.13.2 causes: "Uncaught TypeError: Cannot read property '_currentElement' of null" Upgrading React to 0.13.2 causes: "Uncaught TypeError: Cannot read property '_currentElement' of null" reactjs reactjs

Upgrading React to 0.13.2 causes: "Uncaught TypeError: Cannot read property '_currentElement' of null"


I have figured this out. It comes down to a problem with the render function found in react-d3's linechart/DataSeries. The function checks the type of data by sampling the first element of the data array. However, it does not provide any check to see if the data array is empty.

I had seen errors coming from LineChart before in the form of

Uncaught TypeError: Cannot read property 'x' of undefined

However, I had ignored them since they were access errors and were not stopping the app from running. Something in React must have changed from v0.12.4 to v.0.13.2 such that these previously harmless errors are now breaking. I read the release notes for v0.13.0, v0.13.1, and v.0.13.2 but found nothing that states why this new error would occur. I have not had time to look at the code diff.

I had not connected the two errors because parts of LineChart still throw Uncaught TypeError: Cannot read property 'x' of undefined so I just assumed that the Uncaught TypeError: Cannot read property '_currentElement' of null error was a new one caused by the upgrade and was masking the additional cannot read x errors.

I will be submitting a pull-request to react-d3 shortly to correct this problem. Thank you all for your help.

Update: here is the pull-request


I had the same exact problem with 0.13.2, however, the cause of my error and solution to it were a bit different:

The error came down to my npm version. I was using npm 2.1.4 since upgrading (now at 2.8.4) and running npm update -g npm I was able to get everything working without touching my package.json or anything else.

Let me know if that works for you!


If it can help I had this same error with the Material-UI DropDownMenu component using the bad event Name prop (onItemChange instead of onChange).

    <DropDownMenu menuItems={menuItems} onChange={this._onItemClick}/>

Using the right event prop name solved this issue for me.