React: Cannot read property 'purgeUnmountedComponents' of undefined

Created on 29 Nov 2016  Â·  7Comments  Â·  Source: facebook/react

I'm getting this error when trying to render a component:

Cannot read property 'purgeUnmountedComponents' of undefined

image

What does it mean and how can I fix it?

Most helpful comment

If you load the minified react.min.js with the unminified react-dom.js then you get this error when using version 15.4.

To fix it, you should use the unminified copy of both files or the minified copy of both files – don't mix and match.

We should likely change the behavior here so you don't get a cryptic error.

All 7 comments

If you load the minified react.min.js with the unminified react-dom.js then you get this error when using version 15.4.

To fix it, you should use the unminified copy of both files or the minified copy of both files – don't mix and match.

We should likely change the behavior here so you don't get a cryptic error.

I got this problem using both minified react.min.js and minified react-dom.min.js occasionally, here is the log:
image

Fixed by using unminified files, wish this problem will be fixed in minified files.

@chaotyler
Please provide a project reproducing the problem.

im new in react js looking for tutorials for it

@gaearon
I'm kind of finding out the reason, I'm using server-side rendering and re-render the hole page in the browser-side, here is the simplest example to reproduce this problem:

  1. Get the current time in component constructor:

image

  1. Display the current time in the html:

image

  1. The error comes out because the time differs between the server-side and browser-side, (I was using now.getSeconds(), so the error was not showed every time)

It is the coding problem in my component, but the error messages(different using different react libs) are not friendly, for example:

Using react.js and react-dom.js(this is the error message I really need)

image

Using react.min.js and react-dom.js:

image

Using react.min.js and react-dom.min.js:

image

Try my demo: https://github.com/chaotyler/mini_react_problem_demo

Yes, We should be using either both minified or un minified version!

I’ll close since this error doesn’t happen on master, and there is a clear solution for 15 (don’t mix minified and unminified files).

Was this page helpful?
0 / 5 - 0 ratings