componentDidMount() { firebaseApp.database().ref().child('lastest').on('value', (snapshot) => { this.props.dispatch(showPaperList(snapshot.val())) }) }
constructor(props) { super(props); this.addNote = this.addNote.bind(this); this.removeNote = this.removeNote.bind(this); // 1. connect to firebase this.app = firebase.initializeApp(fire_config); this.database = this.app.database().ref().child('notes'); this.state = { notes: [] } }
// Your App Code constructor(props) { super(props) var myFirebaseRef = firebaseApp .database() .ref(); this.itemsRef = myFirebaseRef.child('items'); this.state = { newTodo: '', todoSource: new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2 }) }; this.items = []; }
constructor(config) { this.connection; try { this.connection = firebase.app().database(); } catch(e) { this.connection = firebase.initializeApp(config).database(); } this.storage = new Storage(firebase.storage()); this.auth = new Auth(); this.user = new User(this.connection, this.storage); this.movie = new Movie(this.connection, this.storage); this.review = new Review(this.connection, this.storage); }