app.tsx 812 B

1234567891011121314151617181920212223242526272829
  1. import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
  2. import '@/utils/headers-polyfill.js'
  3. import { PropsWithChildren } from 'react'
  4. import { useLaunch } from '@tarojs/taro'
  5. import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
  6. import { AuthProvider } from './utils/auth'
  7. import { CartProvider } from './contexts/CartContext'
  8. import './app.css'
  9. // 创建新的 QueryClient 实例
  10. const queryClient = new QueryClient()
  11. function App({ children }: PropsWithChildren<any>) {
  12. useLaunch(() => {
  13. console.log('App launched.')
  14. })
  15. // children 是将要会渲染的页面
  16. return (
  17. <QueryClientProvider client={queryClient}>
  18. <AuthProvider>
  19. <CartProvider>{children}</CartProvider>
  20. </AuthProvider>
  21. </QueryClientProvider>
  22. )
  23. }
  24. export default App