title: How to use realtime database in react native when loged using firestore?
body: <p>So I am here to ask if there is a method to use firebase with real-time database in 1 apps.
  My login already worked using Firestore.</p>
  <p>This is my code that is storing 1 text to my Firestore data, Its worked too.
  I want to change it to real-time database whenever there a new data inserted, but still have the id user logged to my react-native app</p>
  <p><strong>The point is I want to use Realtime Database instead of Firestore.
  Login as Firestore, Save data as Realtime Database</strong></p>
  <pre><code>import React, { useEffect, useState } from 'react'
  import { FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native'
  import styles from './styles';
  import { firebase } from '../../firebase/config'
  
  export default function HomeScreen(props) {
  
      const [entityText, setEntityText] = useState('')
      const [entities, setEntities] = useState([])
  
      const entityRef = firebase.firestore().collection('entities')
      const userID = props.extraData.id
  
      useEffect(() =&gt; {
          entityRef
              .where(&quot;authorID&quot;, &quot;==&quot;, userID)
              .orderBy('createdAt', 'desc')
              .onSnapshot(
                  querySnapshot =&gt; {
                      const newEntities = []
                      querySnapshot.forEach(doc =&gt; {
                          const entity = doc.data()
                          entity.id = doc.id
                          newEntities.push(entity)
                      });
                      setEntities(newEntities)
                  },
                  error =&gt; {
                      console.log(error)
                  }
              )
      }, [])
  
      const onAddButtonPress = () =&gt; {
          if (entityText &amp;&amp; entityText.length &gt; 0) {
              const timestamp = firebase.firestore.FieldValue.serverTimestamp();
              const data = {
                  text: entityText,
                  authorID: userID,
                  createdAt: timestamp,
              };
              entityRef
                  .add(data)
                  .then(_doc =&gt; {
                      setEntityText('')
                      Keyboard.dismiss()
                  })
                  .catch((error) =&gt; {
                      alert(error)
                  });
          }
      }
  
      const renderEntity = ({item, index}) =&gt; {
          return (
              &lt;View style={styles.entityContainer}&gt;
                  &lt;Text style={styles.entityText}&gt;
                      {index}. {item.text}
                  &lt;/Text&gt;
              &lt;/View&gt;
          )
      }
  
      return (
          &lt;View style={styles.container}&gt;
              &lt;View style={styles.formContainer}&gt;
                  &lt;TextInput
                      style={styles.input}
                      placeholder='Add new entity'
                      placeholderTextColor=&quot;#aaaaaa&quot;
                      onChangeText={(text) =&gt; setEntityText(text)}
                      value={entityText}
                      underlineColorAndroid=&quot;transparent&quot;
                      autoCapitalize=&quot;none&quot;
                  /&gt;
                  &lt;TouchableOpacity style={styles.button} onPress={onAddButtonPress}&gt;
                      &lt;Text style={styles.buttonText}&gt;Add&lt;/Text&gt;
                  &lt;/TouchableOpacity&gt;
              &lt;/View&gt;
              { entities &amp;&amp; (
                  &lt;View style={styles.listContainer}&gt;
                      &lt;FlatList
                          data={entities}
                          renderItem={renderEntity}
                          keyExtractor={(item) =&gt; item.id}
                          removeClippedSubviews={true}
                      /&gt;
                  &lt;/View&gt;
              )}
          &lt;/View&gt;
      )
  }
  </code></pre>
  <p>Can someone help me and tell me how to do that?
  thanks</p>