When writing web pages and applications, you often have to somehow manage the structure of the document. This is usually done using the Document Object Model (DOM). We will consider some of the patterns recommended for accessing and modifying the DOM, which focus on high performance.
The Module Pattern is one of the most common design patterns used in JavaScript and for good reason. The module pattern is easy to use and creates encapsulation of our code. Modules are commonly used as singleton style objects where only one instance exists. The Module Pattern is great for services and testing/TDD.
Next.js is inspired by PHP and benefits from a great system of JavaScript modules, which allows us to export the components of our application, which allows us to perform individual tests for each component, as well as download thousands of components or modules from npm