mirror of
https://github.com/supabase/supabase.git
synced 2026-07-02 07:34:43 +08:00
* Move old functions trouble shooting to new guides
* Replace getUser, update, and switch to codeblocks
* Revert "Move old functions trouble shooting to new guides"
This reverts commit 229c581172.
* Prettier
* Add env details
* Fixes
28 lines
652 B
TypeScript
28 lines
652 B
TypeScript
import 'react-native-url-polyfill/auto'
|
|
import { useState, useEffect } from 'react'
|
|
import { supabase } from './lib/supabase'
|
|
import Auth from './components/Auth'
|
|
import { View, Text } from 'react-native'
|
|
import { User } from '@supabase/supabase-js'
|
|
|
|
export default function App() {
|
|
const [user, setUser] = useState<User | null>(null)
|
|
|
|
useEffect(() => {
|
|
supabase.auth.getUser().then(({ data: { user } }) => {
|
|
setUser(user)
|
|
})
|
|
|
|
supabase.auth.onAuthStateChange((_event, session) => {
|
|
setUser(session?.user ?? null)
|
|
})
|
|
}, [])
|
|
|
|
return (
|
|
<View>
|
|
<Auth />
|
|
{user && <Text>{user.id}</Text>}
|
|
</View>
|
|
)
|
|
}
|