Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Serverless Web Applications with React and Firebase

You're reading from   Serverless Web Applications with React and Firebase Develop real-time applications for web and mobile platforms

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher Packt
ISBN-13 9781788477413
Length 284 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Harmeet Singh Harmeet Singh
Author Profile Icon Harmeet Singh
Harmeet Singh
Mayur Tanna Mayur Tanna
Author Profile Icon Mayur Tanna
Mayur Tanna
Arrow right icon
View More author details
Toc

Best practices with Firebase


In Firebase, we all know that data is stored in JSON tree format, which is synchronized in realtime to every connected device. So while building cross-platform applications (web, iOS, and Android) with Firebase, we can share one instance to all your apps to receive the latest updates with new data from Realtime Database. So when we add the data into the JSON tree, it becomes the node in the existing JSON Structure with an associated key, so we always need to plan how data will be saved to build a properly structured database.

Writing the data

In Firebase, we have four methods available to write a data into the Firebase database:

set( )

Write or replace data to a defined path, like messages/tickets/<uid>.

update( )

Update to specific children of node without replacing the other child nodes. We can also use the update method to update the data into multiple locations.

push( )

To add a list of data in the database, we can use the push() method; it generates a unique...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime