简体   繁体   English

对象作为 React 子项无效(找到:object,键为 {seconds, nanoseconds})。 如果你打算渲染一个孩子的集合,使用一个数组

[英]Objects are not valid as a React child (found: object with keys {seconds, nanoseconds}). If you meant to render a collection of children, use an array

I worked now 33 days straight to code my app.我现在连续工作 33 天来编写我的应用程序。 Everything works fine.一切正常。 Yersterday evening there occurs this error:昨天晚上出现这个错误:

Error: Objects are not valid as a React child (found: object with keys {seconds, nanoseconds}). If you meant to render a collection of children, use an array instead.

I undo my changes, the error is still there.我撤消了我的更改,错误仍然存在。 I decided to checkout an old commit.我决定检查一个旧的提交。 At the moment of commit, the codebase works.在提交的那一刻,代码库工作。 I have a running app in testmode on google play.我在 Google Play 的测试模式下有一个正在运行的应用程序。

But today... even this code has this error.但是今天......即使是这段代码也有这个错误。 I could imagine this is a Firebase rules problem because they forced me after 30 days to change them.我可以想象这是一个 Firebase 规则问题,因为他们强迫我在 30 天后更改它们。 but after my changes the code runs for a while.但在我更改代码后运行了一段时间。

    [Unhandled promise rejection: Error: Objects are not valid as a React child (found: object with keys {seconds, nanoseconds}). If you meant to render a collection of children, use an array instead.]
at http://192.168.178.47:19000/node_modules/expo/AppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:281758:22 in <unknown>

在此处输入图像描述 在此处输入图像描述

Firebase converts date/time to timestamp objects {seconds: number, nanoseconds: number} so if you passing that in the date field from your response object, you get that error. Firebase 将日期/时间转换为时间戳对象{seconds: number, nanoseconds: number}因此,如果您在响应 object 的日期字段中传递它,则会收到该错误。 you have to convert the firebase date to javascript date or string.您必须将 firebase 日期转换为 javascript 日期或字符串。 See this question from more 从 more 看到这个问题

暂无
暂无

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

相关问题 对象作为 React 子项无效(找到:object,键为 {}) - Objects are not valid as a React child (found: object with keys {}) React/FireStore:错误:对象作为 React 子项无效 - React/FireStore : Error: Objects are not valid as a React child 对象作为 React 子项无效 - firebase 数据库,axios - Objects are not valid as a React child - firebase database, axios 如何通过反应从前端将 object 添加到我的 firestore? 不断收到错误 Uncaught Error: Objects are not valid as a React child - How can I add an object to my firestore from the frontend with react? Keep getting the error Uncaught Error: Objects are not valid as a React child React - 从 Firebase 获取集合并更新 state 以呈现子组件 - React - Getting collection from Firebase and updating state to render a child component 将用户数据添加到 Firestore 时出现“对象作为 React 子项无效” - "Objects are not valid as a React child" when adding user data to Firestore 显示数据类型为 map 的 Firestore 数据:错误:对象作为 React 子项无效 - Display Firestore Data with a datatype of map: Error: Objects are not valid as a React child 我如何访问日期:{秒:1649365178,纳秒:0} firebase firestore 反应? - How do i access date: at {seconds: 1649365178, nanoseconds: 0} firebase firestore in react? 如何修复 Objects are not valid as a React child in next JS 13 and Next Auth? - How to fix Objects are not valid as a React child error in next JS 13 and Next Auth? 如何使用反应钩子用一组键多次替换数据? - How do you replace data multiple times with an array of keys using a react hook?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM