useFirebase
useFirebase() is a composable that provides access to core Firebase services including Authentication, Firestore, and Storage. It also supports automatic connection to local Firebase emulators during development.
Example Usage
ts
const { auth, firestore, app, storage } = useFirebase()
await signInWithEmailAndPassword(auth, email, password)
const docRef = doc(firestore, "users/user123")Setup Tip
Ensure your .env file or runtime config contains:
ts
runtimeConfig: {
public: {
firebaseConfig: {
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
}
}
}