Next.js Discord

Discord Forum

Loading screen before globalstate load

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
I am using redux-toolkit, I have been managing the cookies and loading a user if there are any. But there is a delay of 1 second in between the components loading (Not showing, for example, the navbar with the options a logged user should have), and the component finally changing to the correct view of a logged user.
This are some of the solutions (Not a single one works :c ) I tried:
1 - <Suspense fallback={<Loading/>}> doesn't work because only works on component loading and not on states (local or global).
2 - dynamic change on states and different rendering also doesn't work.
 return(
        <>
            {
                isLoaded === true ? <>{children}</> : <Loading/>
            }
        </>
    )

(Yes I know its horrendous)
Is there any way to render a <Loading/> before injecting the global state?

0 Replies