I'm doing react-native project with expo + supabase.
From its QuickStart docs, (https://supabase.com/docs/guides/with-expo#launch)
import 'react-native-url-polyfill/auto'
import { useState, useEffect } from 'react'
import { supabase } from './lib/supabase'
import Auth from './components/Auth'
import Account from './components/Account'
import { View } from 'react-native'
import { Session } from '@supabase/supabase-js'
export default function App() {
const [session, setSession] = (useState < Session) | (null > null) // <-- what is this?
useEffect(() => {
setSession(supabase.auth.session())
supabase.auth.onAuthStateChange((_event, session) => {
setSession(session)
})
}, [])
return (
<View>
{session && session.user ? (
<Account key={session.user.id} session={session} />
) : (
<Auth />
)}
</View>
)
}
I can't figure out how this useState works.
I know that | is bit-wise OR operator, but how does this work with useState?