Reputation: 125
I am making an app with React and Firebase. So, to interact with the database from the client (React), do I need an API? What are the upsides/downsides of using something like db.collection("cities").get()
or using an API to make a request to
firestore.googleapis.com/v1/projects/YOUR_PROJECT_ID/databases/(default)/documents/cities
Upvotes: 0
Views: 89
Reputation: 317760
The API provided by the client SDK is easier to consume, and will store documents in a local cache, so they can be used offline (if you enable it for web apps). The REST API is harder to use and does nothing to help you cache results on the device.
Upvotes: 2