React App 中的 Drizzle 组件 - 无法读取未定义的属性。上述语句出现在中。成分

发布于 2025-01-17 12:07:33 字数 1161 浏览 0 评论 0原文

我正在尝试在React应用程序中使用毛毛雨,以显示前端的智能合约详细信息。然而,该错误遇到了这个错误,说


drizzle-react-components.js:1 
        
       Uncaught TypeError: Cannot read properties of undefined (reading 'methods')
    at new o 
` Further errors in console

` 8index.js:1

   The above error occurred in the <o> component:

at o (http://localhost:3000/static/js/vendors~main.chunk.js:466:9)
at div
at div
at http://localhost:3000/static/js/main.chunk.js:198:7
at LoadingContainer (http://localhost:3000/main.0b8989a9c050f470ba10.hot-update.js:35:5)
at v (http://localhost:3000/static/js/vendors~main.chunk.js:2751:19)
at div
at App

加载容器是由我创建的,这是该脚本的内容,

import React from "react";
import { drizzleReactHooks } from "@drizzle/react-plugin";

const { useDrizzleState } = drizzleReactHooks;

function LoadingContainer({children}) {
  const drizzleStatus = useDrizzleState(state => state.drizzleStatus);
  if(drizzleStatus.initialized === false) {
    return "Loading ...";
  }
  return (
    <>
      {children}
    </>
  )
}

export default LoadingContainer;

任何指针如何重新安装此脚本,我真的陷入了这个问题。

谢谢

松露 反应 细雨

I am trying to use Drizzle inside a React App to show the smart contract details in the front end. However stuck at this error, which says


drizzle-react-components.js:1 
        
       Uncaught TypeError: Cannot read properties of undefined (reading 'methods')
    at new o 
` Further errors in console

` 8index.js:1

   The above error occurred in the <o> component:

at o (http://localhost:3000/static/js/vendors~main.chunk.js:466:9)
at div
at div
at http://localhost:3000/static/js/main.chunk.js:198:7
at LoadingContainer (http://localhost:3000/main.0b8989a9c050f470ba10.hot-update.js:35:5)
at v (http://localhost:3000/static/js/vendors~main.chunk.js:2751:19)
at div
at App

The Loading Container is created by me, and this is the content of this script

import React from "react";
import { drizzleReactHooks } from "@drizzle/react-plugin";

const { useDrizzleState } = drizzleReactHooks;

function LoadingContainer({children}) {
  const drizzleStatus = useDrizzleState(state => state.drizzleStatus);
  if(drizzleStatus.initialized === false) {
    return "Loading ...";
  }
  return (
    <>
      {children}
    </>
  )
}

export default LoadingContainer;

Any pointer how to resole this, I am really stuck with this issue.

Thanks

truffle
react
drizzle

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文