We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Uncaught TypeError: Cannot read property 'className' of undefined

I encountered a problem when I try to conditionally render some of your components: SwitchComponent, TextBoxComponent (maybe others too, haven't tried).

We are using redux and fetching some data over API. When data is loading we are displaying loader and when the data is fetched, I want to display a form including components mentioned above.

I can also reproduce the problem with code below:

Error inside console:

Any ideas how to resolve this?

Dependency versions:

Noticed the issue here: Switch component gets rendered the first time and on next re-render it's removed since loading is true. This is when the error is triggered.

8 Replies

AD Arunkumar Devendiran Syncfusion Team November 20, 2019 02:44 AM UTC

Hi Nejc, 
Thank you for contacting Syncfusion support. 
Before we start to work on this, we would like to know the following details,            
1. Could you please confirm us in which case you are trying to destroy the switch? 
             2. If possible, please provide the issue replicated sample. 
Could you please ensure the above details and get back to us with more information. The information provided would be great help for us to resolve your issue. 
Arunkumar D 

CH Christian December 10, 2019 11:28 AM UTC


I think we have the same problem in our enviroment (react-rouer/redux). If I switch the page by react-router the component is working, but if I refresh the page I will get an error for every ej2 react component:

Uncaught TypeError: Cannot read property 'className' of undefined at removeClass at SwitchComponent, DocumentEditor and more ...

The error is called in the destroy function under ej2-react-base.

EDIT: I have found a similar ticket under https://www.syncfusion.com/feedback/9901/how-to-solve-uncaught-typeerror-cannot-use-in-operator-to-search-for-eventlist-in. Is this fixed or planed in a new release?

HC Harini Chellappa Syncfusion Team December 12, 2019 01:54 PM UTC

Hi Christian,


We are currently validating the reported scenario. Will update more details on this by Dec 16, 2019.



Harini C 

HC Harini Chellappa Syncfusion Team December 16, 2019 05:51 PM UTC

Hi Christian,


When navigating or refreshing the page, are you calling any refresh API or destroy API of the component?


When switching, will you create and destroy the components? Can please share the scenario to reproduce this console error in detail, so that we can check further and provide solution.



Harini C

CH Christian January 13, 2020 11:00 AM UTC

Hi Harini,

sorry for the long time with no answer.

I'm not calling any API's or something only the document editor.
You will find the files in the appendix with error images.

Best regards,

Attachment: files_ee60a4df.zip

SM Suriya Murugan Syncfusion Team January 14, 2020 12:29 PM UTC

Hi Chris, 
Thanks for sharing the information. 
Currently, we are validating the provided details and update you more details on or before January 20,2020. 
Suriya M. 

AT Amarender Tangella August 3, 2021 04:25 PM UTC

@ Syncfusion Team Any updates on this?

SM Suriya Murugan Syncfusion Team August 4, 2021 07:11 AM UTC

Hi Amarender, 

Can you please confirm still facing issue in latest version(19.2.51) and check this by upgrading your packages to latest version? 

If yes, please share the video representation of the issue, that will be helpful for us to proceed further and provide you solution at earliest. 

Suriya M. 

Live Chat Icon For mobile
Up arrow icon