Reputation: 103
I'm making demo app. Data is stored in firebase. Now I'm loading data to my app just by axios get method. But from now I want add redux to my app. I saw some tutorials about connect firebase with redux, but my problem is that I want load data only once from firebase (on start app) and don't make any operation with firebase later. I mean after reload app I want to have this same initial state of application. Do you have any suggestion, I'm new with react and redux and don't have any idea how to do it.
Upvotes: 0
Views: 487
Reputation: 599956
Have a look at the Firebase documentation, specifically the section labeled reading data once. From there comes this example:
var userId = firebase.auth().currentUser.uid; return firebase.database().ref('/users/' + userId).once('value').then(function(snapshot) { var username = (snapshot.val() && snapshot.val().username) || 'Anonymous'; // ... });
Upvotes: 1