'Router.push('/') would display nothing

When I try to go to the home page for a user who is not logged in with Next JS, the path moves, but nothing is displayed.

  if (!currentFBUser) {
    return Router.push('/')
  }

The following error occurred on other pages.

Unhandled Runtime Error Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.

How can I fix this?



Solution 1:[1]

  if (!currentFBUser) {
    Router.push('/')
  }

Worked!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 k10a