0
I’m creating an app with react
and currently need to recover some data from database
using the library of firebase
, for this I created a module that performs the configuration:
Filing cabinet: firebase.js
import firebase from 'firebase';
const config = {
apiKey: "XYZ",
authDomain: "XYZ.firebaseapp.com",
databaseURL: "https://XYZ.firebaseio.com",
projectId: "XYZ",
storageBucket: "XYZ.appspot.com",
messagingSenderId: "123"
};
export default firebase.initializeApp(config);
Inside another module I include the configuration module and start using:
import React, { Component } from 'react'
import firebase from '../../firebase'
export default class MeuComponent extends Component {
componentDidMount () {
console.log('did mount');
var dbRef = firebase.database().ref().child('apiDataReference');
dbRef.on('value', snap => console.log(snap.val()));
}
...
}
When the component is rendered I see the did mount
used in the console.log()
, but I get the following error next:
unreachable code after Return statement Learn more
How is the method
render
of this component?– Sergio
is a @Sergio form
– RFL
Somewhere in your component you have a code Return after it is not used, you can check that?
– Sergio
I already checked @Sergio, unfortunately I found that this error only happens in firefox.
– RFL