简体   繁体   English

React和firebase setState'您必须指定“ to”属性'

[英]React and firebase setState 'you must specify the “to” property'

I tried many hours but can't seem to find what I am doing wrong, I am new to react so I really appreciate your help. 我尝试了许多小时,但似乎找不到我做错的地方,我是新来的反应者,非常感谢您的帮助。 I first had an array state of accommodations, then I looped through them with a map function and everything was ok. 我首先有一个容纳状态的数组状态,然后用map函数遍历它们,一切正常。 But after I connected firebase with the project the map function didn't work because firebase was an object so I had to change the map function and assign Object.keys first. 但是,当我将firebase与项目连接后,由于firebase是一个对象,所以地图功能无法正常工作,因此我不得不更改地图功能并首先分配Object.keys。 Then there is an error that says 'you must specify the "to" property' highlighting me the setState method. 然后出现一个错误,提示“您必须指定“至”属性”,突出显示setState方法。 I have an image attached to the error. 我有一张附有错误的图片。 I am so sorry for my poor English, thank you so much for your help 很抱歉我的英语不好,非常感谢您的帮助

ErrorImage 错误图片

在此处输入图片说明

In my case. 就我而言。 I used incorrect structure for <Link> component in an other file related to this file. 我在与此文件相关的其他文件中为<Link>组件使用了错误的结构。

Wrong structure : 结构错误:

<Link href="...">

Correct structure : 正确的结构:

<Link to="...">

after this change, it's ok. 进行此更改后,就可以了。

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

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