Reputation: 158
I am trying to convert a static HTML theme into a react theme. The static theme has some simple JS used to change the CSS classes. I've included those scripts into my react's index.html. Now the problem is, when I try to navigate from one component to another, the loading animation starts and doesn't render further and console shows some errors about the members are undefined. But when I manually reload the page, it renders just fine. Did anyone had the same problem? What can be the work arounds?
I've also tried removing and then reloading the js files from the component in componentDidMount().
Upvotes: 2
Views: 961
Reputation: 158
The issue was because the JS used for animation in that particular code should work according to the page load/unload events. Since I was using react then I had to manage the animation according to the componentDidMount and will mount like event functions. Moreover, the better approach while converting a static HTML website code to react would be to substitute components with the suitable npm modules rather than investing your time to investigate the issue.
Upvotes: 1