elizabethrakhibaby / DabaoBuddy

An interactive app that aims to establish a takeaway system within the NUS campus that benefits both time-pressed students in need of quick meals and financially independent students seeking opportunities to earn allowances via delivery services.
0 stars 1 forks source link

Finance Screen #17

Closed elizabethrakhibaby closed 1 year ago

elizabethrakhibaby commented 1 year ago

Update finance screen, to trigger fetching of finance data, by coming useIsFocused hook and useEffect.

We used React Hooks, specifically useEffect and useIsFocused, to streamline the process of fetching data from Firestore and dynamically updating the screen. By using the useEffect hook, we were able to define an effect that triggers whenever the component gains focus, allowing us to efficiently fetch the necessary data. The useIsFocused hook, in conjunction with useEffect, provided a reliable mechanism to determine if the screen was currently focused, enabling targeted data retrieval and re-rendering. This approach ensured a responsive user interface and efficient data synchronization, aligning with best practices in software engineering.