Walthy docs

Previewing Content

Previewing Content Locally

Next.js automatically rebuilds changes and serves them on localhost:3000. This makes it easy to preview updates in real-time while developing.

Steps to Preview Content

  1. Start your development server by running npm run dev or yarn dev in your terminal.
  2. Open your browser and navigate to http://localhost:3000.
  3. Make any changes to the code in your project files. Next.js automatically rebuilds the changes and updates the browser preview.

Using Fast Refresh

Next.js includes a powerful feature called *Fast Refresh*. This means that any changes made to the content or components will instantly reflect in your browser without losing component state.

For instance:

              
    {`function Header() {
      return (
       
          

Updated Header

); }`}

Once you save the file, the updated header will display immediately.

Debugging Previews

If you encounter any issues during preview:

  • Ensure the development server is running.
  • Check the terminal for errors or logs.
  • Clear the browser cache or perform a hard refresh (Ctrl+Shift+R or Cmd+Shift+R).

Production Preview

To test your content in a production-like environment, build the application and serve it locally:

              
    {`npm run build
    npm start`}
              
            

Then visit http://localhost:3000 to preview the production build.