Skip to content

How to show a loading while getting async storage data #8559

Closed Answered by avegatolber
avegatolber asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks, final code:

type Props = {
    children: ReactNode
}

const QueryRestoring = ({ children }: Props) => {
    const isRestoring = useIsRestoring()

    return isRestoring ? <FullScreenSpinner /> : children
}

const QueryProvider = ({ children }: Props) => {
    return (
        <PersistQueryClientProvider
            persistOptions={{ persister, maxAge }}
            client={queryClient}
        >
            <QueryRestoring>{children}</QueryRestoring>
        </PersistQueryClientProvider>
    )
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TkDodo
Comment options

@avegatolber
Comment options

Answer selected by avegatolber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants