javascript - semantic-ui-react <Responsive> 不适用于 <Table.Cell>

标签 javascript reactjs responsive semantic-ui semantic-ui-react

我正在使用 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/

相关文章:

javascript - 使用 google maps api 3 和 js 创建样式器

html - 如何通过表格上的图标保留文本(响应式设计)

html - 带有按钮+框文本问题的响应式英雄图像

javascript - jQuery 可以操作不在 DOM 上的 HTML 吗?

javascript - 带有两个参数的 JS 函数,引用不同的对象

javascript - 宇宙数据库 : how to query for the existence of a value nested in a json array?

ios - react native : What is the difference between using Cocoapods and manually linking modules?

javascript - 如何在 native react 中的对象属性字符串中给出行空间

reactjs - 如何在某些情况下删除 React hook?

html - 如何在移动/平板电脑 View 中在 css 的不同行上显示内容?