Sunday, 23 June 2019

Sync React App with Firebase Real-time Database


---- fbConfig.js import * as firebase from 'firebase'; var config = {     apiKey: '',     authDomain: '',     databaseURL: '',     projectId: '',     storageBucket: '',     messagingSenderId: '',     appId: '' }; firebase.initializeApp(config); export default firebase; ---- App.js import firebase from './fbCOnfig'; state = {     speed: 0 }; componentDidMount () {     const rootRef = firebase.database().ref().child('react');     const speedRef = rootRef.child('speed');     speedRef.on('value', (snap) => {         this.setState({ speed: snap.val() });     }); }

No comments:

SQL: Generate a range of numbers

SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n FROM       (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),      (VALU...