javascript - TypeError : Children 不是函数 react-visibility-sensor
问题描述
在构建时,此页面上有错误说明 TypeError : Children is not a function react-visibility-sensor
class VisibilitySensor extends Component {
constructor(props) {
super(props);
this.state = {
active: true
};
}
render() {
const { active } = this.state;
const { once, children, ...theRest } = this.props;
return (
<VSensor
active={active}
onChange={isVisible =>
once &&
isVisible &&
this.setState({ active: false })
}
{...theRest}
>
{({ isVisible }) => children({ isVisible })}
</VSensor>
);
}
}
解决方案
推荐阅读
- microsoft-graph-api - 如何将 SimpleProvider 与我自己的 MSAL C# 代码一起使用
- ios - 在 queue.sync { self._state } 处崩溃
- php - 在 Laravel 中更新大量数据
- python - django 3.1.3 版本中不存在模板
- python - 无法从 python 服务器将图像上传到 Firebase 存储
- flutter - 在 null 上调用 getter 'length' 在预先存在的 json 上调用
- html - 如何保持页面固定
- php - PHP DateTime::__construct():无法解析位置 8 (0) 的时间字符串:意外字符
- google-cloud-firestore - 结合 facebook 登录和正常注册的 firebase 规则
- python - 无法通过 windows 中的诗歌安装 torchvision