'error with connecting my react app with firebase
I am learning ReactJS and I am blocked when I try to synchronize my firebase data base with my state in the componentWillMount. I think is because the lesson I have and the langage has been update.
this is base.js
import Rebase from 're-base';
const base = Rebase.createClass({
apiKey: "AIzaSyBYurAdM8P7Pt7xdLPb3TXqqGh4oFKyGjY",
authDomain: "ma-chat-box-e1482.firebaseapp.com",
databaseURL: "https://ma-chat-box-e1482.firebaseio.com",
});
export default base;
And my componentWillMount is
import base from 'base';
componentWillMount() {
this.ref = base.syncState('/', { // this line send me an error !
context: this,
state: 'messages'
});
}
and the error is :
ypeError: __WEBPACK_IMPORTED_MODULE_3_base___default.a.syncState is not a function
thank for help !
Solution 1:[1]
I found my mistake. it was in my base page base.js
is
import Rebase from 're-base';
var base = Rebase.createClass({
apiKey: "*****",
authDomain: "*****",
databaseURL: "*****",
storageBucket: "*****",
messagingSenderId: "*****"
});
export default base;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | victorfau |
