<OneAuxiliaLoading>

The <OneAuxiliaLoading> renders its children while OneAuxilia is loading, and is helpful for showing a custom loading state.

Usage

App Router

app/layout.tsx
import { OneAuxiliaProvider, OneAuxiliaLoaded, OneAuxiliaLoading } from '@oneauxilia/nextjs'
import './globals.css'

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <OneAuxiliaProvider>
      <html lang="en">
        <body>
          <OneAuxiliaLoading>
            <div>OneAuxilia is loading...</div>
          </OneAuxiliaLoading>
          <OneAuxiliaLoaded>{children}</OneAuxiliaLoaded>
        </body>
      </html>
    </OneAuxiliaProvider>
  )
}

Pages Router

pages/_app.tsx
import '@/styles/globals.css'
import { OneAuxiliaLoaded, OneAuxiliaLoading, OneAuxiliaProvider } from '@oneauxilia/nextjs'
import { AppProps } from 'next/app'

function MyApp({ Component, pageProps }: AppProps) {
  return (
    <OneAuxiliaProvider {...pageProps}>
      <OneAuxiliaLoading>
        <div>OneAuxilia is loading</div>
      </OneAuxiliaLoading>
      <OneAuxiliaLoaded>
        <Component {...pageProps} />
      </OneAuxiliaLoaded>
    </OneAuxiliaProvider>
  )
}

export default MyApp

Last updated