Firebase
React

【React】Firebaseからデータを取得する

// Firebase/config.js
export default {
  API_KEY: "******************************************",
  AUTH_DOMAIN: "******************************************",
  DATABASE_URL: "******************************************",
  STORAGE_BUCKET: "******************************************",
}

// Firebaes/index.js
import firebase from 'firebase'
import CONFIG from './config'

const config = {
    apiKey: CONFIG.API_KEY,
    authDomain: CONFIG.AUTH_DOMAIN,
    databaseURL: CONFIG.DATABASE_URL,
    storageBucket: CONFIG.STORAGE_BUCKET,
};
firebase.initializeApp(config)

export default firebase

// Home/index.js
import React from 'react';
import firebase from '../Firebase'

// ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
constructor(){
    super();
    this.state = {
      productList: []
    }

    var firebaseRef = firebase.database().ref('products');

    firebaseRef.on('value', (snapshot) => {
      var products = snapshot.val();

      this.setState({
        productList: products
      })
    })
  }


参考

http://qiita.com/kazushikawamura/items/58ea222b3cc289882d79