How can i get 'Router' and 'window' in 'Constructor' of class component in nextjs ? #13492
Replies: 2 comments
-
Since Next.js prerenders to HTML to ensure your app is fast, you cannot always access You can only use |
Beta Was this translation helpful? Give feedback.
-
If i will check user is authenticated or not in 'componentDidMount' , then if user is authenticated then page fluctuate while get auth user details in 'componentDidMount' using api. ex. user is not authenticated, then user access any authorized page 'home' at url, then first render home page and then know user is not authenticated and we will redirect to login page. there is any way where we can check user authentication, if then can you please saher example. this is we are doing in angular using 'Authgaurd'. Thanks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How can i get 'Router' and 'window' in 'Constructor' of class component in nextjs ?
Beta Was this translation helpful? Give feedback.
All reactions