Posts

Showing posts with the label error boundary

Guide to Using NextJS App Router

Image
Introduction NextJS App Router is a revolution in building web applications with React, bringing optimized performance and a modern development experience: App Router: A new routing system based on React Server Components, allowing for complex data processing directly on the server, reducing the bundle size sent to the client, and supporting excellent data streaming. Folder-based Routing: Routing is defined based on the folder structure. Each folder represents a URL segment (segment), helping manage code intuitively and easily set up shared layouts. Server Actions: Allows you to write data processing functions (such as writing to a database) that run directly on the server but can be easily called from client components without needing to build manual API endpoints. Here, when using the App Router, there will be special files to distinguish between global (root app) and local as follows: Global: global-error.tsx : This must be a client component, used as an error boundary for the entir...