【发布时间】:2020-12-03 21:15:04
【问题描述】:
我尝试创建一个登录页面,这就是我在尝试登录时遇到的错误。我试图解决它,但我没有找到任何解决方案。
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)
注册和其他页面对我来说都很好,所以我想知道我在登录时搞砸了什么。
【问题讨论】:
-
pastebin.com/zvCjzJag是login.component.js的代码
-
看起来您正试图将一个对象渲染为一个反应组件...如果没有看到导致此问题的代码,我们将无法为您提供更多帮助。尝试制作一个可重现的小例子并在这里分享
-
请在您的问题中显示您的代码。
-
pastebin.com/LCD2J7GV - App.js
-
@Aza 您能否编辑您的问题并将其包含在此处而不是场外