【发布时间】:2021-05-21 00:03:04
【问题描述】:
我正在监听一个 Firebase 节点.....然后当 FBS 中发生更改时,我将快照与 Redux 中的当前内容进行比较。疯狂的是,Redux 状态甚至在我调度之前就已经反映了 FBS 中的更新值(来自快照)
const listenToFbsMyUserNode = (dispatch) => {
database()
.ref('profiles/users/')
.on('value', snapshot => {
let state = store.getState(); //at this point Redux somehow already knows about the updated value before Ive dispatched!!!
//now can dispatch
dispatch(_refreshMyProfile(snapshot.val()));
});
};
【问题讨论】:
标签: react-native redux react-redux react-native-firebase