concept browser in category nextjs

appears as: browser, The browser, browser
Next.js in Action

This is an excerpt from Manning's book Next.js in Action.

  • Its responsibilities go well beyond serving content to a browser.
  • The aim of a dev server is to make developing your React application as seamless an experience as possible. Imagine that you’re working on a component of your application. There’s a simple change that you want to make but you need to be able to see the result since you’ll likely need to tweak the change several times. Ideally, the time between saving the source code and seeing the resulting change in the browser should be as close to zero as possible. For example, if you have additional steps to take between making the change and seeing the result, you lose your feedback loop. Here is a high-level illustration of the development loop while building a React application:

    Figure 1.1 The React dev server development cycle
    A close up of a logo Description automatically generated

    The developer works on the component source, the development server picks up the change, the updated component is sent to the browser, and the developer can make their next move based on how the result looks.

    To make this development cycle a reality, the dev server must do several things. First, it needs to monitor all the application source files for changes. When a change is detected, it then needs to re-bundle the parts of the application that have changed. This involves compiling JSX or any other non-JavaScript syntax such as TypeScript into JavaScript and then combining several source files into one. When the bundle is ready, it is delivered to the browser. In the browser, we have a dev server client that listens for new bundles and updates the app accordingly.

    On their own, React components just render static content in the browser. The content that a component displays is determined by the markup that it returns. Markup itself is static, but because JSX markup is embedded inside of JavaScript, it isn’t difficult to make page elements dynamic. For example, to render a list of data, you can map array values to <li>
    tags. The question is, is this array static or dynamic?