From e1922cd2b35dcc7ff6312191eb92e8afe819bcb7 Mon Sep 17 00:00:00 2001 From: Arpit Banati Date: Mon, 15 Jun 2020 13:40:05 +0530 Subject: [PATCH] dpcs: Update Docs for realtime listeners (#3778) [skip-ci] --- docs/database/usage/index.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/database/usage/index.md b/docs/database/usage/index.md index 7b0cc382..c124f5a6 100644 --- a/docs/database/usage/index.md +++ b/docs/database/usage/index.md @@ -98,10 +98,10 @@ import database from '@react-native-firebase/database'; function User({ userId }) { useEffect(() => { - const subscriber = database(); - ref(`/users/${userId}`).on('value', snapshot => { - console.log('User data: ', snapshot.val()); - }); + const subscriber = database() + .ref(`/users/${userId}`).on('value', snapshot => { + console.log('User data: ', snapshot.val()); + }); // Stop listening for updates when no longer required return () => subscriber(); @@ -124,10 +124,10 @@ import database from '@react-native-firebase/database'; function User({ userId }) { useEffect(() => { - const subscriber = database(); - ref('/users').on('child_added', snapshot => { - console.log('A new node has been added', snapshot.val()); - }); + const subscriber = database() + .ref('/users').on('child_added', snapshot => { + console.log('A new node has been added', snapshot.val()); + }); // Stop listening for updates when no longer required return () => subscriber();