javascriptfirebasegoogle-cloud-firestore

'getDoc' is not exported from 'firebase/firestore'


enter image description here I'm trying to use firebase hooks with firebase 8.0.0 I keep getting this error : 'getDoc' is not exported from 'firebase/firestore'. Can anyone point out what I'm doing wrong? Thanks.

Edit: I've switched to Version 9.21.0 but now can't use firebase at all. Here is the code for my firebase.js file. Any help greatly appreciated.


Solution

  • The top-level getDoc function was introduced in version 9 of the Firebase SDK. In version 8 and before, you'd use the something like firebase.firestore().doc("path/to/your/doc").get() to do the same.

    Also see the Firebase documentation on getting a document in version 8 of the JavaScript SDK.