Firebase offers the offline experience outside of the box. There's no need to do any magical trick or write any piece of code; all you need to do is to focus on your application logic and exploit the Firebase API in the best way you can. All the changes you will do to the database will be synchronized once connected to a stable connectivity source.
In this recipe, we'll see how we can know whether we're simply connected to our database or not; this feature is simple but can help us enormously in improving our user experience.