[英]React App Crashes When a certain Component Rendered
To be honest, I don't know what really causes the problem but will try to explain it.老实说,我不知道真正导致问题的原因,但会尝试解释。 In my react app, I have placed a Google Translate Widget (which is retired some years ago) to easily translate whole website in just a click.在我的 React 应用程序中,我放置了一个 Google 翻译小部件(几年前已停用),只需单击一下即可轻松翻译整个网站。 It works fine until I am clicking on a MODAL or some button that changes TAB without changing routes.它工作正常,直到我单击 MODAL 或某个按钮来更改 TAB 而不更改路线。 I mean, when routing there is no problem but if new component renders in the same route (like it does in MODAL and TAB component), the app crashes and all I am getting is a blank page.我的意思是,路由时没有问题,但如果新组件在同一路由中呈现(就像在 MODAL 和 TAB 组件中一样),应用程序崩溃,我得到的只是一个空白页面。 Images to make it clearer:图片使其更清晰:
As it seems, Google translated page to French in homepage here is a different route and everything seems OK.看起来,谷歌将主页中的页面翻译成法语是一条不同的路线,一切似乎都很好。 BUT when I click on Make a Reservation Button (which is the vertical one) or All Features button (which is the black one at the bottom), distressingly this is what I get:但是,当我点击“预订按钮”(垂直按钮)或“所有功能”按钮(底部黑色按钮)时,令人沮丧的是,这就是我得到的:
A blank page.空白页。 So, without using google-translate-widget all is working without a problem.因此,在不使用 google-translate-widget 的情况下,一切都没有问题。 But if the page is translated and user clicks on a button renders some component on the same route this happens.但是如果页面被翻译并且用户点击一个按钮在同一路径上渲染一些组件,就会发生这种情况。 ANY solution suggestion or comment means so much to me.任何解决方案建议或评论对我来说意义重大。 Thank you.谢谢你。
I got the component which cause the insertBefore error inside span tag.我得到了导致 span 标记内的 insertBefore 错误的组件。 It solved the issue.它解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.