What's the difference between Firebase JavaScript SDK and react-native-firebase
Asked Answered
U

4

20

I am trying to use to use Firebase (Cloud Firestore) for a react-native app, to store my JSON objects.

I ve seen people using Firebase in their apps (npm install firebase), and others using react-native-firebase.

Most blogs say that Firebase itself is meant for web, so their react-native support is none/less. While a few other blogs and firebase official blog say that Firebase supports react-native.

I am not sure which library to choose, for my react-native project, and what's the difference between them.

Ukase answered 1/10, 2018 at 10:19 Comment(0)
A
17

According to project description on GitHub:

React Native Firebase is a light-weight javascript layer connecting you to the native Firebase SDKs for both iOS and Android which aimes to mirror the offical Firebase Web SDK as closely as possible.

Although the official Firebase JS SDK will work with React Native; it is mainly built for the web and has a limited feature-set compared to native.

So, you should choose it, for react native platform. This will allow you to use more features and also benefit from using native sdk's (speed, memory consumption, etc.)

Asomatous answered 1/10, 2018 at 12:1 Comment(3)
Thank you for the reply. It helped. Although, talking about "limited feature-set", my requirement includes a simple editing of an array in a JSON object, which Firebase JS SDK supports (firebase.google.com/docs/firestore/manage-data/…), but i couldn't find such method on react-native-firebase. I wonder if it is really mirroring !!!Ukase
@Ukase firebase actually doesn't work with arrays (at least not, as you would expect it to work), check docsAsomatous
@Ukase The arrayUnion and arrayRemove operations are quite new additions to Cloud Firestore. There is an issue to track adding them to react-native-firebase: github.com/invertase/react-native-firebase/issues/1389. The release notes show that arrayContains has been added to 5.0.0, with arrayUnion and arrayRemove support "coming" soon.Cottar
S
4

Add up from Dima Rostopira's Answer.

You need to use JS SDK in react native when you use expo. Because expo not let you add custom native modules. Else go with react native SDK

Soelch answered 11/10, 2019 at 7:31 Comment(0)
E
4

According to doc https://docs.expo.dev/guides/using-firebase/#usage-with-expo

if use expo, you still can use react-native-firebase instead of the https://github.com/firebase/firebase-js-sdk, but need plugin

Entomologize answered 3/2, 2022 at 10:15 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Franklyn
More detail to answer will help people in understanding the difference better.Physiologist
B
0

You can consider using the Firebase JS SDK when you:

  • Want to use Firebase services such as Authentication, Firestore, Realtime Database and Storage in your app.
  • Also, you want a quick start with Firebase services.
  • Want to create a universal app for Android, iOS and the web.

You can use the React Native Firebase when:

  • Your app requires access to Firebase services not supported by the Firebase JS SDK, such as Dynamic Links, Crashlytics, Firebase Analytics etc.
  • You want to use native SDKs in your app.

You can check here: Why react-native-firebase over firebase-js-sdk?

Bootjack answered 17/6, 2024 at 18:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.