// this screen shows up after the user has authenticated
export default function App() {
const [checkingIfExists, setCheckingIfExists] = useState(false)
const [userExists, setUserExists] = useState(false)
const onAuthStateChanged = async (user) => {
const uid = user.uid // user id
// show loading indicator
setCheckingIfExists(true)
// check DB to see if the user exists
const { exists } = await doesUserExistInDb(uid)
// set state based on the DB value
// set loading state to false
setCheckingIfExists(false)
// user is not signed in, reset the state
setCheckingIfExists(false)
// if the DB call is loading
if (checkingIfExists) return <LoadingScreen />
// if the user doesn't exist
if (!userExists) return <OnboardingStack />
// user exists! render the app