任何人都有任何示例,如何针对使用功能组件的React Native应用程序使用react-redux取消从firebase的onSnapshot预订?
答案 0 :(得分:0)
您需要从useEffect析构函数回调中调用unsubscribe方法。
public class MyClass
{
public ReadOnlyCollection<ReadOnlyMyItem> MyItems { get => GetMyItems(); }
private List<MyItem> myItems;
// ...
private ReadOnlyCollection<ReadOnlyMyItem> GetMyItems()
{
throw new NotImplementedException();
}
// ...
}
public class MyItem
{
// ...
}
public class ReadOnlyMyItem
{
private readonly MyItem myItem;
// ...
public ReadOnlyMyItem(MyItem myItem) => this.myItem = myItem;
// ...
}