I have a problem, I made my app with .once('value', but when I restart my app, the content of firebase is still the same, it didn't update.
Why this?
I have a problem, I made my app with .once('value', but when I restart my app, the content of firebase is still the same, it didn't update.
Why this?
I am not sure if I understand your question, but if you want to retrieve firebase data each time you restart your app, you can put the code in a class constructor and initiate the class in your main view, like following:
class SettingsStore{
constructor() {
firebase.initializeApp(YOUR_CONFIG);
super(firebase.database().ref());
firebase
.database()
.ref(YOUR_REFERENCE)
.once("value")
.then(function(snapshot) {
let new_data = snapshot.val();
});
}
settingsStore = new SettingsStore();
export default settingsStore;
Then you can load the class in your main app view
import settings from "./settingsStore";
Hope this answers your question