react-native - componentDidMount 换屏
问题描述
在屏幕之间切换时是否启用数据调用。
我可以用这段代码调用一次
async componentDidMount() {
return fetch("https://www.xxxx.com/app/messages", options)
}
解决方案
我解决了
async componentDidMount() {
this.load()
this.props.navigation.addListener('willFocus', this.load)
}
load = async () => { }
推荐阅读
- javascript - 如何在项目后添加 const。而不是数据中的名称?
- julia - 导出函数名称会导出 Julia 中所有不同的函数版本吗?
- node.js - 使用 Facebook 实时数据的 Power BI 报表
- mysql - SQL LEFT JOIN 未使用表 2 中的值填充列
- python - Django查询多对多关系以查找用户
- python - 仅对列值具有连续差异的行进行切片
- processing - 处理中的像素橡皮擦
- c# - 使用 Process.Start() 表示权限被拒绝
- java - Java:有没有办法创建一个对象但让对象连续运行自己的代码?
- java - 建议中未识别 AspectJ 类型间字段