0👍
✅
As explained in the vuefire documentation for declarative binding:
Any Database Reference provided in a
firebase
option will be bound at
creation (after Vue’screated
hook) to the specified key on the
component
So you actually don’t need to add anything in the mounted
hook. If you want to trigger an action when the cats
array is populated, you can use a standard Vue.js watch
.
If you don’t want to subscribe to real time changes in the RTDB cats
ref (i.e. do a binding in vuefire vocabulary) and only want to read once the cats
node data when the component is mounted, you should use the standard Firebase JS SDK, as explained here in the vuefire doc.
Source:stackexchange.com