manniru
5/11/2018 - 3:52 PM

fb.js

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

import fb from './fb';
const testRef = fb.database().ref('/tests');



class App extends Component {

  constructor() {
    super();
    //this.toggleFavorite = this.toggleFavorite.bind(this);
    //this.saveFavorite = this.saveFavorite.bind(this);
    ///this.getData = this.getData.bind(this);

    this.state = {
      name: '',
    }
    ///this.getData();
  }

  componentDidMount() {
    testRef.child("name").on('value', snapshot => {
      console.log(snapshot.val())
        this.setState({name: snapshot.val()});
    });
  }
  render() {
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <h1 className="App-title">Value is {this.state.name}</h1>
        </header>

      </div>
    );
  }
}

export default App;
import firebase from 'firebase'

var faker = require('faker');

var config = {
    apiKey: "mm",
    authDomain: "mm",
    databaseURL: "mm",
    projectId: "mm",
    storageBucket: "mm",
    messagingSenderId: "mm"
  };
var fb = firebase.initializeApp(config);

export default fb;