useRefirebase
Hook to access the global Refirebase instance.
Usage
Returns the instance provided by RefirebaseProvider. This is the primary way to access auth, db.firestore, db.realtime, and db.storage in your React components.
ℹ
This hook must be used within a component wrapped in
RefirebaseProvider.MyComponent.tsx
import { useRefirebase } from 'refirebase/react';
export function MyComponent() {
const { auth, db } = useRefirebase();
const handleAction = async () => {
// Access auth methods
await auth.handleSignOut();
// Access database methods directly
const userDoc = await db.firestore.get('users', { docId: '123' });
};
return <button onClick={handleAction}>Action</button>;
}Return value
Returns
Refirebase<T>The initialized Refirebase instance.