When my application starts I do an initial fetch to Firebase to pull down all my data. When I later add data to my Firebase, I only want it to get the new child that's been added.
I'm currently achieving this like this. Is there a better way, or a built in way to do this in Firebase?
let initialFetch = false;
ref.once('value', snap => {
// get all child data
initialFetch = true;
});
ref.on('child_added', (snap) => {
if (!initialFetch) return;
// get new child data
});
Any help is appreciated. Thanks in advance!