Expo/React-Native and Firebase

Expo/React-Native and Firebase

Apr 29, 2025

image

[last updated: 2025/05/06]

TL; DR

My Recommendation


Given all of the info below, my advice to anyone just getting started with Expo/RN or with Firebase: start with the Firebase Web Client SDK. Consider a move to React-Native-Firebase once you have a handle on how the technologies work and that you have confirmed you need the native functionality that the Web Client doesn't provide.

The Details


There is a LOT of information on the interwebz about using Firebase and React-Native. There are a lot of avenues and choices and .... it is really easy to get lost even when just getting started.

Note that there is a lot of misinformation too. When it comes to info about Expo, React-Native and/or Firebase, I encourage my team to look for recent info and to ignore older info. Expo and React-Native in particular have evolved greatly in the past year or so (circa 2022), so my advice is to ignore any information published more than 9 months ago. Look for newer sources.

Choosing between using Expo/React-Native or just using React-Native directly is a no-brainer:
Use Expo

Heck, even React-Native's documentation lists Expo as the first way to get started with RN:
image

Starting with Expo/RN and Firebase also offers a few options. And with a good portion of the Expo/RN and Firebase communities trying to remain neutral on many topics, the lack of an opinionated stance makes it challenging for newcomers to really know where to look.

Using Expo/RN, you mainly have the following options for working with Firebase:

  • Firebase Web Client SDK

  • React-Native-Firebase

I recently provided the following input to the Expo team as a means of clarifying some of the noise that exists in the general ecosystem:

Firebase Web Client SDK pros:

  • built and maintained by the Firebase team (Google)

  • 100% JavaScript

  • can be added/used/updated without compiling a new client

  • can be used in Expo Go

  • simply run expo install firebase and start using it — no plugins to configure

  • works great with react-native-web

  • v9 of the API is modular, so “only import what you need” (v8 API was “all-in-one” so you imported code for services that you didn’t use)

  • consistent use with normal web examples (e.g. ReactJS apps)

Firebase Web Client SDK cons:

  • no ability to use “native” behaviours

  • e.g. Crashlytics & some device-specific analytics

React-Native-Firebase pros:

  • has access to “native” capabilities: Dynamic Links, App Distribution, Crashlytics

  • Messaging background delivery can start your app

  • AppCheck leverages device-level attestation

  • background downloads for Storage

  • enhanced Performance tracking

  • modular — import only the parts of the API that you need for your app

React-Native-Firebase cons:

  • currently supports a “v8/namespaced API syntax” (object-oriented, not function-oriented)!

    • With v18.x, availability of the "v9/modular API syntax" is here! 🎉

  • has “native bits”, so cannot use with Expo Go (it is not compiled into Expo Go)

  • requires building your own Expo client and additional configuration (RNF's Config Plugin)

  • does not work with react-native-web  [NOTE: I’m pretty sure about this…happy to be corrected]

RNFirebase (additional details):

  • built and maintained by Invertase (not the Firebase team itself, though RNF is built on top of the Firebase native SDKs for iOS and Android)

Подобається цей допис?

Купити для gregfenton каву

Більше від gregfenton