我正在使用 semantic-ui react 来呈现数据表。我的要求是当页面在移动 View 上时,我隐藏某些列。我尝试在 Table.Cell
元素上使用 className="mobile hidden"
但这似乎根本不起作用。
然后我尝试使用如下所示的 Responsive
组件,但出现错误。我在这里错过了什么吗?找不到其他人有这个问题......
<Responsive as={Table.Cell} minWidth={Responsive.onlyMobile.minWidth}>
{record.datapoint}
</Responsive>
调整窗口大小时,我在控制台中收到此错误...
index.js:2177 Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.
Please check the code for the Responsive component.
最佳答案
事实上,这是一个错误 :( 我已经创建了 PR 来解决所描述的问题,请参阅 Semantic-Org/Semantic-UI-React#2421。
您提供的代码不会重现问题,提供的示例永远不会出现该问题。然而,它存在 :) 核心问题是 Responsive
组件的卸载,当它将由父级完成时,setState()
将在未安装的组件上调用。 codesandbox 上的示例重现问题。
关于javascript - semantic-ui-react <Responsive> 不适用于 <Table.Cell>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48093185/