Home > Net >  Import query for both Realtime Database and Firestore Firebase web v9
Import query for both Realtime Database and Firestore Firebase web v9

Time:06-15

When importing the query function for Firebase Realtime DB and Firestore, I noticed both query functions have the exact same name.

import { query } from "firebase/database";
import { query } from "firebase/firestore";

This is mentioned here and here in the documentation.

Is this the same function from both places? If not, should I just alias the import of one of the functions?

CodePudding user response:

You can set an alias for one of the imports. Try:

import { query } from "firebase/database";
import { query as fireQuery } from "firebase/firestore";


const firestoreQuery = fireQuery(...)
  • Related