Skip to content

Instantly share code, notes, and snippets.

@pflevy
Last active September 8, 2019 14:16
Show Gist options
  • Save pflevy/2e015861e4ac4c50786e53cb35751309 to your computer and use it in GitHub Desktop.
Save pflevy/2e015861e4ac4c50786e53cb35751309 to your computer and use it in GitHub Desktop.
Creating custom react hooks. Real-time firebase database entry listener example. Firebase config.
import firebase from "firebase";
const projectId = "YOUR_PROJECT_ID";
var firebaseConfig = {
apiKey: "YOUR_WEB_API_KEY",
authDomain: `${projectId}.firebaseapp.com`,
databaseURL: `https://${projectId}.firebaseio.com`,
projectId: projectId
};
// Uncomment if you wan't to use my database instead of your own's. Also comment/remove the above config.
// const projectId = "customhookexample";
// var firebaseConfig = {
// apiKey: "AIzaSyBKy_HyHuY1TWp0jZT8vzR5D0jB6n7",
// authDomain: `${projectId}.firebaseapp.com`,
// databaseURL: `https://${projectId}.firebaseio.com`,
// projectId: projectId
// };
firebase.initializeApp(firebaseConfig);
export default firebase;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment