node.js - React 错误:对象作为 React 子对象无效
问题描述
我试图创建一个登录页面,这就是我在尝试登录时遇到的错误。我试图解决它,但我没有找到任何解决方案。
Error: Objects are not valid as a React child (found: object with keys {}). If you meant to render a collection of children, use an array instead.
in div (at login.component.js:136)
in div (at login.component.js:135)
in form (created by t)
in t (created by Form(t))
in Form(t) (at login.component.js:92)
in div (at login.component.js:85)
in div (at login.component.js:84)
in Login (created by Context.Consumer)
in Route (at App.js:140)
in Switch (at App.js:131)
in div (at App.js:130)
in div (at App.js:52)
in App (at src/index.js:10)
in Router (created by BrowserRouter)
in BrowserRouter (at src/index.js:9)
注册和其他页面对我来说工作正常,所以我想知道我在登录时搞砸了什么。
解决方案
您尝试渲染一个对象。尝试Object.values(myObj)
推荐阅读
- javascript - 我什么时候使用 {},什么时候不使用 JavaScript 中的 import
- lisp - car、cdr等的球拍实现
- oracle12c - 如何打开 Oracle Forms/Reports 12c?
- database-design - 防止子实体关系中的属性重复
- php - 使用 youtube-dl 下载 YuoTube 视频的进度条已完成
- javascript - 打开 EDX 无法解码 .weight 文件,内部服务器错误 (XBlock)
- flutter - 颤振)更改键盘工具栏颜色
- azure - Azure 函数和 Azure Cosmos DB 冲突源集成
- javascript - 如何在 GraphQL 中进行突变以创建需要关系的对象
- c++ - 当输入为字符或单词时,不显示“Invalid input”