简体   繁体   English

React 应用程序不会在 Facebook 即时游戏 iframe 内呈现

[英]React app does not render inside Facebook instant game iframe

I have a react app which does not render when zipped and loaded into facebook instant game platform.我有一个 react 应用程序,它在压缩并加载到 facebook 即时游戏平台时不会呈现。 It generates logs such as below, that clearly show that the actions are firing.它生成如下日志,清楚地表明操作正在触发。 See the logs with Middleware ACTION-NAME below.请参阅下面带有Middleware ACTION-NAME的日志。

If someone can give me ideas on what could be going wrong, that would be great.如果有人能给我一些关于可能出什么问题的想法,那就太好了。 Does JSX in an iframe need some special permissions to write to the #root tag? iframe 中的 JSX 是否需要一些特殊权限才能写入 #root 标记?

在此处输入图片说明

I solved it thus,我是这样解决的,

I am using BrowserRouter in react for navigation.我正在使用 BrowserRouter 来响应导航。 I had to change the route path I wanted to load initially from / to * .我不得不将最初想要加载的路由路径从 / 更改为 * 。

-                <Route exact path="/">
+                <Route exact path="*">

It seems like initially, when running the game inside the iframe, the route path did not match / .似乎最初,在 iframe 内运行游戏时,路由路径与/不匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM