Now we're going to create a couple React components. Create a components directory in src and within that, two directories named database and finder. We'll start by creating our database reference:
- In the database directory, create a database.js file. Note that it's js, not jsx, because we're not actually going to render any data. Instead, we're going to return a variable to a jsx component. Your file should look like this:
import * as firebase from 'firebase'
const app = firebase.initializeApp({
apiKey: process.env.REACT_APP_apiKey,
authDomain: process.env.REACT_APP_authDomain,
databaseURL: process.env.REACT_APP_databaseURL,
projectId: process.env.REACT_APP_projectId,
storageBucket: process.env.REACT_APP_storageBucket,
messagingSenderId: process.env.REACT_APP_messagingSenderId,
appId: process.env.REACT_APP_appId
})
const Database = app.database()
export default Database
Note the prefix of process.env on each variable as well as the...