bsky-app/src/App.native.tsx

26 lines
522 B
TypeScript
Raw Normal View History

2022-06-09 20:03:25 +02:00
import React, {useState, useEffect} from 'react'
import {RootStore, setupState, RootStoreProvider} from './state'
2022-06-09 23:32:03 +02:00
import * as Routes from './routes'
2022-06-09 20:03:25 +02:00
function App() {
const [rootStore, setRootStore] = useState<RootStore | undefined>(undefined)
// init
useEffect(() => {
setupState().then(setRootStore)
}, [])
// show nothing prior to init
if (!rootStore) {
return null
}
return (
<RootStoreProvider value={rootStore}>
2022-06-09 23:32:03 +02:00
<Routes.Root />
2022-06-09 20:03:25 +02:00
</RootStoreProvider>
)
}
export default App