Unturect typeError:无法读取空的属性(读取' usestate')

发布于 2025-02-06 08:18:52 字数 1006 浏览 2 评论 0原文

在下面附加的模块Federation Remote和主机应用程序配置中,及其A React TypeScript应用程序。

主机应用程序中使用了一个简单的按钮组件,可以看到具有默认道具的组件,但是当我使用自定义创建 recharts 组件时,组件无法在远程应用中读取传递的道具,但是如果我们记录道具显示数据。

远程

主机

”在此处输入图像描述”

host app.tsx

标记的属性是可选的,在按钮组件中,我能够读取和使用props键值,但无法使用props键Barchart组件中的价值。

错误我会得到

“在此处输入图像说明”

任何建议或解决方案,请回复。

In the module federation remote and host app configs attached below and its a react typescript applications.

A simple button component is used in the host app, able to see the component with default props but when I use the custom created recharts component not able to read the passed props in remote app but if we log the props it shows the data.

Remote

enter image description here

Host

enter image description here

Host App.tsx

Marked properties are optional, in button component i'm able to read and use the props key value but not able to use the props key value in BarChart component.
enter image description here

ERROR i'm getting

enter image description here

Any suggestion or solutions please do reply.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥抱影子 2025-02-13 08:18:52

此问题与临时情况包装器组件有关。
我删除了包装器组件并尝试了它的工作原理,但是我需要不同的解决方案,而无需删除包装器组件。

This issue is related to ResponsiveContainer wrapper component.
I removed the wrapper component and tried it's working but I need different solution without removing the wrapper component.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文