'Can you have a single file with multiple routes in NextJS?

I'm new to React/NextJS and I'm trying to figure out if its possible to have a single file with multiple routes.

Example: Login Page
 When you request domain.com/login it routes to the auth.js file and shows the related component dynamically instead of having 4 different files/pages. This way the whole page isn’t showing a flash of white when moving between them, it is just dynamically switching the dynamic components area in and out.

Right now I have 4 different files in /pages and you get full page refreshes where the page flashes white and this seems silly.

enter image description here



Sources

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

Source: Stack Overflow

Solution Source