import { PropsWithChildren } from 'react'
import { useLaunch } from '@tarojs/taro'
import { RecoilRoot } from 'recoil'

import './styles/tailwind.basic.css'
import { getGlobalConfig } from './apis'


function App({ children }: PropsWithChildren<any>) {
  useLaunch(() => {
    // 初始化全局配置
    loadGlobalConfig()
    console.log('App launched.')
  })

  const loadGlobalConfig = async () => {
    const res = await getGlobalConfig()
    console.log(res)
  }

  return (
    <RecoilRoot>
      {children}
    </RecoilRoot>
  )
}

export default App
