apologies in advance if this is a silly. I'm only a few months into React Native.
I'm a little confused why my app is re-rendering in App.tsx every time I bring the app from the background to the foreground.
Here is the code for App.tsx.
import React, { useState, useEffect } from 'react';import * as Sentry from 'sentry-expo'; import 'react-native-gesture-handler';import { ApolloClient, ApolloProvider, InMemoryCache } from '@apollo/client';import { UserIdContextProvider } from './app/utils/context/UserIdContext'; import {decode, encode} from 'base-64'import { WebSocketLink } from 'apollo-link-ws';import * as Segment from 'expo-analytics-segment';import { DoormanProvider, AuthFlow, AuthGate } from 'react-native-doorman'; import { ActivityIndicator } from 'react-native'import AppNavigator from './AppNavigator';import { colors } from './app/styles/colors';import { withOta } from './app/hoc/with-ota';import firebaseApp from './app/utils/firebase/fbConfig';const iosWriteKey = [IOS_KEY];const androidWriteKey = [ANDROID_KEY];const graphqlEndpoint = [ENDPOINT];export default function App() { console.log("rerendering App"); useEffect(() => { if (!global.btoa) { global.btoa = encode; } if (!global.atob) { global.atob = decode; } Sentry.init({ dsn: [DSN], enableInExpoDevelopment: true, debug: true }); }, []); return(<AuthenticatedApp /> ) };
When I put the app in the background and then bring it back, the console log produces "rerendering App". I thought nothing would re-render, at first glance. Is there something that I'm missing?