Skip to content
Advertisement

No component being rendered on router.push(‘/page’) unless reloaded

On successful login, I’m embedding the user token in browser cookies and using router.push('/dashboard') to take the user to his dashboard, but the ‘/dashboard’ page is not rendering any components unless I trigger a reload, on which all the components are rendered on the screen.

Code block from /login page:

JavaScript

Code block from /dashboard page:

JavaScript

which on first returns a blank white page and on if reloaded, returns:

JavaScript

Advertisement

Answer

Since I had to trigger an update, I went ahead with using window.location.href(‘/dashboard’) which worked. Thanks, @Abhinay.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement