【问题标题】:Minified React error #130 when using react-table使用 react-table 时缩小 React 错误 #130
【发布时间】:2021-06-14 06:11:08
【问题描述】:

我无法使用 react-table(import ReactTable from "react-table") 但我在浏览器控制台中收到以下错误:

Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

请帮助解决这个问题。

【问题讨论】:

    标签: javascript reactjs spfx


    【解决方案1】:

    首先 - 要详细解决您的问题,您必须在使用 react-table 的位置添加代码。

    当你得到缩小的反应错误时,你会得到一个链接来获取扩展的错误文本,所以,我看到了这个:

    元素类型无效:应为字符串(用于内置组件) 或类/函数(用于复合组件)但得到:未定义。

    这意味着,react-table 中的参数之一期望字符串或函数,但得到'underfined'。在我看来,当您使用某些类型为“any”的变量并将类型化参数设置为该变量的值时,可能会发生此错误。

    TS type 'any' 允许在变量中存储任何类型的数据,但 react-table 具有类型化参数,因此当您的变量具有“未定义”并且您尝试使用该值设置类型化变量时 - 您会收到错误消息。

    解决此错误的方法之一是在渲染模式中检查某些数据变量的现有值

    {someData && <renderTable...>}
    

    【讨论】:

      猜你喜欢
      • 2019-01-19
      • 1970-01-01
      • 2018-10-29
      • 1970-01-01
      • 1970-01-01
      • 2019-11-11
      • 2023-02-24
      • 2017-02-25
      • 2021-01-13
      相关资源
      最近更新 更多