问题
If I, for instance, wanted to use firebase's services in a react-native project for things like Auth, google cloud messenger, realtime database, push notifications, A/B testing, and crash reporting, would I choose to npm install the firebase package or the react-native-firebase package?
What are the differences between the two? I'm confused because I thought react-native-firebase was utilizing the whole Firebase SDK which seems to make the Firebase package unnecessary? I found this link: Firebase vs. react-native-firebase, but it didn't clear anything up for me. I'm looking for a practical, in-depth comparison of the two, or what they are and why there are two different ones.
回答1:
The firebase
NPM package is the Firebase SDK for JavaScript developers that run their code in a web browser. It contains the Firebase products for which Firebase itself provides a native JavaScript SDK, mostly things like the databases, authentication, etc.
The reactive-native-firebase
package is a 3rd party SDK for ReactNative developers that run their code in iOS and Android apps. It wraps the native Firebase SDKs for those platforms in a JavaScript SDK, which also includes things like analytics, dynamic links, in-app messaging, etc.
来源:https://stackoverflow.com/questions/57982557/what-are-the-differences-between-react-native-firebase-firebase-npm-packages