17/12/2024
Incremental Static Regeneration (ISR) enables developers and content editors to use static-generation on a per-page basis, without needing to rebuild the entire site. With ISR, you can retain the benefits of static while scaling to millions of pages. Static pages can be generated at runtime (on-demand) instead of at build-time with ISR. Using analytics, A/B testing, or other metrics, you are equipped with the flexibility to make your own tradeoff on build times.
For instance, an e-commerce website with 100,000 products can leverage ISR for:
Next.js uses a combination of static generation and server-side regeneration to implement ISR. When a user requests a page:
1. Next.js can define a revalidation time per page. Let’s set it at 60 seconds.
2. The initial request to the product page will show the cached page with the original price.
3. The data for the product is updated in the CMS.
4. Any requests to the page after the initial request and before 60 seconds are cached and instantaneous.
5. After the 60-second window, the next request will still show the cached (stale) page. Next.js triggers a regeneration of the page in the background.
6. Once the page has been successfully generated, Next.js will invalidate the cache and show the updated product page. If the background regeneration fails, the old page remains unaltered.
The Page Router was the default in Next.js until version 13 introduced the App Router. In this router, ISR is implemented by using the getStaticProps function within a page component.
Key Points:
Next.js 13 introduced the App Router, which is a new way of defining routes and data fetching. The App Router uses React Server Components (RSC) and provides better flexibility and ergonomics. With the App Router, Incremental Static Regeneration is implemented using the fetch function with caching options.
Key Points:
ISR is ideal for scenarios where you need up-to-date content but don’t require real-time data.
Key Use Cases:
Efficient Updates: Avoid full site rebuilds for specific content changes.
Incremental Static Regeneration is a powerful tool when you need a balance between static performance and dynamic updates. It is best used when your content changes on a regular, but not real-time, basis. Whether you're building product pages, blogs, or large-scale content sites, ISR allows you to keep your pages fresh and responsive without sacrificing performance or scalability. Use ISR when you want to give your users fast, static pages with the confidence that content will be up-to-date in the background.
Agile Testing in Scrum: Methods and Best Practices
Agile Testing plays a pivotal role in Agile software development, ensuring that testing aligns with the dynamic, iterative, and collaborative nature of this methodology. This article explores Agile Testing within the context of Scrum, delving into its core principles, the Agile Testing Quadrants, and various methods such as Behavior-Driven Development (BDD), Acceptance Test-Driven Development (ATDD), and exploratory testing. By understanding these concepts, organizations can enhance the quality and efficiency of their software development processes while delivering products that align closely with customer needs.
20/12/2024
Overview about Craft.js - library used for page builder
Building rich, customizable user interfaces is a challenge that many web applications face. Developers need solutions that provide flexibility, performance, and extensibility, especially for drag-and-drop editors, landing page builders, and WYSIWYG content creation. Enter Craft.js, a headless framework for building these complex user interfaces with React. In this guide, we will learn about the architecture of Craft.js, the workflows, custom components, state management, and extensibility.
13/12/2024
Quyet
Related contents
Building rich, customizable user interfaces is a challenge that many web applications face. Developers need solutions that provide flexibility, performance, and extensibility, especially for drag-and-drop editors, landing page builders, and WYSIWYG content creation. Enter Craft.js, a headless framework for building these complex user interfaces with React. In this guide, we will learn about the architecture of Craft.js, the workflows, custom components, state management, and extensibility.
13/12/2024
Quyet