title: ReactNative: how to refresh on data
body: <p>I'm new to React Native code building.
  Below is my React Native code to get data from Firebase.</p>
  <pre><code>const page_one = () =&gt; {
     const [isLoading, setIsLoading] = useState(true)
     const [placeList, setPlaceList] = useState([])
     const [message, setMessage] = useState(false)
  
     const db = firebase.firestore().collection('places')
  
      const onLoad = async () =&gt; {
  
          const place_ref = await firebase.firestore().collection('places').get()
          if (place_ref.empty) {
              setMessage(true)
              return
          }
  
          const places = []
          try {
              place_ref.forEach(doc =&gt; {
                  const entity = doc.data()
                  entity.id = doc.id
                  places.push(entity)
              })
              setPlaceList(places)
              setMessage(false)
              setIsLoading(false)
              return
          } catch (error) {
              console.log(&quot;Error:\n&quot;, error.message)
              return
          }
      }
  
  }
  
      useEffect(() =&gt; {
          onLoad()
          console.log('place List')
      }, [isLoading])
  
  return (&lt;View&gt;&lt;/View&gt;)
  
  }
  </code></pre>
  <p>I need to refresh the current component every time I render, to get newly added data from firebase. How to make possible this.
  As of now component is not loading when I rendering the component 2nd time. it fetches the old data only, not loading the latest data still I refreshing the whole application.</p>
  <p>I need to fetch the latest data whenever I render the component.</p>
  <p>I tried with below useEffect hook:</p>
  <pre><code>    useEffect(() =&gt; {
          onLoad()
          console.log('place List')
      }, [isLoading, placeList])
  </code></pre>
  <p>But it calls the firebase request n number of times till I existing the current component.</p>
  <p>I want to call the firebase request only once when ever I visiting the current component.</p>
  <p>please help me..</p>