gpt4 book ai didi

javascript - 出现错误 : Warning: Failed prop type: Invalid prop `children` supplied to `Form` , 需要 ReactNode

转载 作者:行者123 更新时间:2023-11-30 19:20:41 25 4
gpt4 key购买 nike

我正在使用 final-form 制作一个简单的 useContext 演示。我收到了这个警告

警告:失败的 prop 类型:无效的 propchildren提供给Form,需要一个 ReactNode。

这是我的代码 https://codesandbox.io/s/github/test-gitt

重现我的问题或警告的步骤

  1. 运行应用程序。显示一个按钮。单击按钮。它会显示另一个带有按钮的页面。
  2. 再次单击按钮打开控制台 contrl+alt+I

为什么会出现这个警告?

<BrowserRouter>
<LoadingProvider>
<Router/>
</LoadingProvider>
</BrowserRouter>

enter image description here

有更新吗?

最佳答案

根据我能够使用您提供的代码进行的测试,这就是消除该错误的原因:

在 src > add-agency > index.js:54 中的以下代码行

您必须将 SForm 的子节点包装到一个 Fragment 中,以便子节点只有一个 ReactNode。像这样的东西:

<SForm>
<Fragment>
<Tag />
<Tag />
<Tag />
</Fragment>
</SForm>

请考虑不要发布您的整个代码库,而只需写下一个简单且可重现的示例,该示例可以轻松显示您试图解决的问题。

关于javascript - 出现错误 : Warning: Failed prop type: Invalid prop `children` supplied to `Form` , 需要 ReactNode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57512641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com