App router

NextJS's App Router is a modern framework built on React Server Components that centrally manages file-based routing, layouts, and data fetching within the app/ directory. It is faster than the traditional Pages Router, makes server-side rendering the default, and enables more efficient SPA/MPA development.
Key Features and Benefits of App Router
・Advanced routing: The folder structure under the app/ directory corresponds to URL paths. Define screens in page.tsx and common layouts in layout.tsx.
・Nested layouts: Layouts can be nested by folder, enabling efficient reuse of common UI elements.
・Improved data fetching: Data can be fetched directly within components using async/await. The fetch API has been extended to support powerful caching and revalidation.
・Simplified UI management: Simply placing loading.tsx (loading UI) and error.tsx (error handling) applies Suspense and Error Boundaries.
Server Components vs Client Components
・Server Components (.tsx): Default. Runs on the backend. Can access databases and APIs directly.
・Client Components (“use client”;): Used when interactivity (useState, useEffect, event listeners) is required





