Firebaseui with reactfire in v9 #474
-
Is there a way to still use reactfire and firebaseui? Even if we are just using the compat mode only for Firebaseui? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I know @jamesdaniels is hard at work with this update, and calls this out here firebase/firebaseui-web#877 (comment) I am wondering if anyone has used it in this way yet? |
Beta Was this translation helpful? Give feedback.
-
Okay I have this working for the most part, still getting a weird Firestore error on login prior to refresh, but other than that it is working with reactfire, v9, and firebaseui (v9 aka 0.600.0 that @jamesdaniels put out on the Here is my working example in codingcat.dev but I will try and make a smaller one soon for Firebase Summit demo. |
Beta Was this translation helpful? Give feedback.
-
Here's an example of how to use Firebase v9 and ReactFire v4 normally throughout the rest of a web app, and only worry about the import StyledFirebaseAuth from "react-firebaseui/StyledFirebaseAuth";
import { useAuth } from "reactfire";
// compat SDK needed for FirebaseUI
import firebase from "firebase/compat/app";
import "firebase/compat/auth";
export function SignInForm() {
// get the v9 auth instance normally using ReactFire
const v9AuthInstance = useAuth();
// convert the v9 auth instance into a v8 auth instance
const v8AppInstance = firebase.initializeApp(v9AuthInstance.app.options);
const v8AuthInstance = v8AppInstance.auth();
const uiConfig = {
// ... insert your react-firebaseui config here
};
return (
<StyledFirebaseAuth firebaseAuth={v8AuthInstance} uiConfig={uiConfig} />
);
} This works with:
Note that since we have to import the compat library, this is not good for keeping bundle size down. I'd strongly recommend importing this example |
Beta Was this translation helpful? Give feedback.
Here's an example of how to use Firebase v9 and ReactFire v4 normally throughout the rest of a web app, and only worry about the
compat
sdk in the component that sets up react-firebaseui'sStyledFirebaseAuth
: