js, the correct way to persist components between page changes is to use the custom App component . It’s quite simple. All you have to do is to create the file /pages/_app. js if it doesn’t exist already, and add the components you want to persist in there.