javascript - 添加额外的类字段会引发流类型错误
问题描述
我尝试按照React 文档每隔 x 秒调用一个函数,如下所示:
componentDidMount () {
const { dispatch, match } = this.props
dispatch(loadPipelineExecutions(match.params.pipelineId))
this.reloadExecutions = setInterval(
() => dispatch(loadPipelineExecutions(match.params.pipelineId)),
3000
)
}
componentWillUnmount () {
clearInterval(this.reloadExecutions)
}
但我收到一个流类型错误,提示:无法分配到setInterval(...)
,this.reloadExecutions
因为.reloadExecutions
TableExecutionsContainer
这是正常的流动行为吗?
解决方案
推荐阅读
- stored-procedures - SQL Server 2017 存储过程需要声明表变量,但它已经存在
- php - 502 网关故障(1-C Bitrix)
- python - 如何计算列表中的重复列表?Python
- swift - iOS非阻塞状态栏
- java - 使用 Process 从 Java 代码执行 Java 程序
- javascript - 在记忆游戏中点击卡片不会翻转它
- android - 获取与网页上的按钮相关联的链接
- javascript - 在 javascript 画布中绘图无法正常工作
- r - 如何在 R 中并行分隔多行?
- python - When i use a for loop with an array it doesn't work and uses the number of items instead of going item by item