I can't get Firebase realtime database data, getting exception and can't understand why.
"SyntaxError: Unexpected end of input
at App.componentDidMount (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:1571:45)
at App.proxiedComponentDidMount (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:57980:42)
at commitLifeCycles (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:31136:28)
at commitLayoutEffects (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:33340:13)
at Object.invokeGuardedCallbackImpl (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:20647:16)
at invokeGuardedCallback (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:20743:37)
at commitRootImpl (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:33172:15)
at unstable_runWithPriority (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:55717:18)
at runWithPriority (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:24203:16)
at commitRoot (blob:http://localhost:8081/debac782-dd29-4750-a1b8-dc8e57c59632:33041:9)"
In the App.js constructor I initialize firebase like this (works fine):
if (!firebase.apps.length) {
firebase.initializeApp(config);
}
And in componentDidMount() I am trying to get the database ref:
componentDidMount() {
firebase.database().ref('listings').once("value", snapshot => {
//handle snapshot data
});
}