我的 Jest 测试失败,因为每次运行测试时密钥中的时间戳都不同:
\n\n FAIL ./App.test.js\n \xe2\x9c\x95 renders without crashing (72ms)\n\n \xe2\x97\x8f renders without crashing\n\nexpect(value).toMatchSnapshot()\n\nReceived value does not match stored snapshot 1.\n\n- Snapshot\n+ Received\n\n@@ -347,11 +347,11 @@\n "index": 0,\n "isTransitioning": false,\n "key": "StackRouterRoot",\n "routes": Array [\n Object {\n- "key": "id-1519567169760-0",\n+ "key": "id-1519567814666-0",\n "routeName": "Menu",\n },\n ],\n },\n }\nRun Code Online (Sandbox Code Playgroud)\n\n这是我的 App.js 文件:
\n\nimport React from \'react\';\nimport { StackNavigator } from \'react-navigation\';\nimport Menu from \'./components/Menu\';\nimport List from \'./components/List\';\n\nconst RootStack = StackNavigator(\n {\n Menu: {\n screen: Menu,\n },\n List: {\n screen: …Run Code Online (Sandbox Code Playgroud) 我们的客户将我们的JS标签添加到页面的顶部。我们的标签需要在修改页面之前知道reactJS何时完成。
我已经尝试使用jQuery,$(document).ready()但是在reactJS完成之前会触发。我可以使用,$(window).load()但是如果页面上有很多图像,这将太慢。
有哪些绑定完成的选项React.renderComponent?