Last active
September 8, 2019 14:16
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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