我无法使用react-table(从“react-table”导入ReactTable ),但我在浏览器控制台中收到以下错误:
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.请帮助解决此问题。
发布于 2021-03-17 16:18:01
首先-为了详细解决你的问题,你必须添加你的代码,在那里你使用react-table。
当你得到最小化的react错误时,你会得到链接来获得扩展的错误文本,所以,我看到了这个:
元素类型无效:应为字符串(对于内置组件)或类/函数(对于复合组件),但got: undefined。
这意味着,react-table中的一个参数需要字符串或函数,但得到的是'underfined‘。在我看来,当您使用某个类型为'any‘的变量并使用此变量的值设置类型化参数时,可能会发生此错误。
TS类型' any‘允许在变量中存储任何类型的数据,但是react-table有类型化的参数,所以当你的变量有'undefined’并且你试图用这个值设置类型化的变量时-你会得到一个错误。
解决此错误的一种方法是在渲染模式时检查某个数据变量的现有值
{someData && <renderTable...>}https://stackoverflow.com/questions/66664051
复制相似问题