This confused me the first time I saw it in a Next.js project. A folder with brackets around the name => (auth). (dashboard). (marketing). Looks wrong. Feels wrong. But it's one of the most useful patterns in the framework. 🤔 Parentheses in Next.js folder names are invisible to the URL. 👻 "/app/(auth)/login" → renders at "/login" "/app/(dashboard)/jobs" → renders at "/jobs" The parentheses never show up in the browser. They exist purely for the developer. 🧑💻 What you get is the ability to group routes that share the same layout without polluting the URL. Your auth pages get one layout. Your dashboard gets another. Zero overlap. Zero hacks. ✅ One punctuation character. Completely changes how you organise your app. 🔥 Small thing. But once you know it, you can't unsee it. 👀 What other Next.js conventions tripped you up the first time? #nextjs #webdevelopment #javascript #typescript #fullstackdeveloper
Next.js Folder Conventions: Understanding Parentheses in Route Names
More Relevant Posts
-
𝐔𝐧𝐝𝐞𝐫𝐬𝐭𝐚𝐧𝐝𝐢𝐧𝐠 𝐅𝐢𝐥𝐞-𝐁𝐚𝐬𝐞𝐝 𝐑𝐨𝐮𝐭𝐢𝐧𝐠 𝐢𝐧 𝐍𝐞𝐱𝐭.𝐣𝐬 In React you define every route manually. You install React Router. You create a routes file. You map every path to every component yourself. It works. But as your app grows that file becomes a mess. ───────────────────── Next.js throws that approach out completely. There is no routes file. No configuration. No setup. 𝘠𝘰𝘶𝘳 𝘧𝘰𝘭𝘥𝘦𝘳 𝘴𝘵𝘳𝘶𝘤𝘵𝘶𝘳𝘦 𝘪𝘴 𝘺𝘰𝘶𝘳 𝘳𝘰𝘶𝘵𝘪𝘯𝘨 𝘴𝘺𝘴𝘵𝘦𝘮. ───────────────────── 𝐇𝐨𝐰 𝐢𝐭 𝐰𝐨𝐫𝐤𝐬: You create a folder called dashboard inside the app folder. You add a page.tsx file inside it. That is it. Next.js automatically creates the route /dashboard No imports. No setup. No configuration. 𝘑𝘶𝘴𝘵 𝘢 𝘧𝘰𝘭𝘥𝘦𝘳 𝘢𝘯𝘥 𝘢 𝘧𝘪𝘭𝘦. ───────────────────── 𝐖𝐡𝐚𝐭 𝐚𝐛𝐨𝐮𝐭 𝐝𝐲𝐧𝐚𝐦𝐢𝐜 𝐫𝐨𝐮𝐭𝐞𝐬? Same idea. Wrap the folder name in square brackets. app/ blog/ [slug]/ page.tsx This handles URLs like: /blog/my-first-post /blog/nextjs-is-awesome The [slug] becomes a dynamic parameter that changes per page. No extra setup. No additional configuration. 𝘑𝘶𝘴𝘵 𝘴𝘲𝘶𝘢𝘳𝘦 𝘣𝘳𝘢𝘤𝘬𝘦𝘵𝘴 𝘢𝘳𝘰𝘶𝘯𝘥 𝘢 𝘧𝘰𝘭𝘥𝘦𝘳 𝘯𝘢𝘮𝘦. ───────────────────── 𝐖𝐡𝐲 𝐭𝐡𝐢𝐬 𝐚𝐜𝐭𝐮𝐚𝐥𝐥𝐲 𝐦𝐚𝐭𝐭𝐞𝐫𝐬: → A new developer joins your team and instantly understands every route just by looking at the folder structure → No separate file to maintain as your app grows → Adding a new page is as simple as adding a new folder → Your folder structure becomes the architecture of your entire app 𝘍𝘪𝘭𝘦-𝘣𝘢𝘴𝘦𝘥 𝘳𝘰𝘶𝘵𝘪𝘯𝘨 𝘢𝘭𝘴𝘰 𝘶𝘯𝘭𝘰𝘤𝘬𝘴 𝘴𝘰𝘮𝘦𝘵𝘩𝘪𝘯𝘨 𝘱𝘰𝘸𝘦𝘳𝘧𝘶𝘭. Each folder can have its own loading state. Its own error handling. Its own layout. All of that comes from the folder structure itself. We will get to those in the upcoming posts. 𝘕𝘦𝘹𝘵 𝘱𝘰𝘴𝘵 → page.tsx — the one file that actually makes a route show up in the browser. How were you handling routing before Next.js? 👇 #nextjs #reactjs #webdevelopment #frontenddevelopment #javascript #softwareengineering
To view or add a comment, sign in
-
Your React app doesn't have a bundle size problem. It has a loading strategy problem. I spent last week auditing a Next.js project that shipped 420KB of JavaScript on the landing page. The team thought they needed to "rewrite in Astro." They didn't. What they needed was to stop treating every component like it required client-side hydration. Here's the mental model I use: if a component doesn't respond to user input within the first 3 seconds of page load, it doesn't need to be in your initial bundle. Period. Three changes cut their bundle by 60%: 1. Moved data-fetching logic to Server Components. No more useEffect chains firing on mount. 2. Lazy-loaded everything below the fold with dynamic imports and a simple IntersectionObserver trigger. 3. Replaced a 90KB animation library with 14 lines of CSS @keyframes. The result? Time to Interactive dropped from 4.2s to 1.6s on mobile. Bounce rate fell 23% in two weeks. We obsess over framework choices when the real wins are in delivery strategy. SSR, selective hydration, code splitting — these aren't buzzwords. They're the difference between a site that converts and one that makes users wait. Ship less JavaScript. Measure what actually loads. Your users on a 3G connection will thank you. 📉
To view or add a comment, sign in
-
React + Netlify: Why Nested Routes Like /shop/jackets Return 404 When we deploy a React app on Netlify, we are not deploying multiple pages like traditional websites. Instead, React builds our project into a folder (build) that mainly contains an index.html file, along with JavaScript and CSS files. So when someone opens our website: ✔️ Netlify first sends index.html ✔️ Then JavaScript loads the full React app ✔️ After that, React handles everything inside the browser ✔️ Now the important part: The build we upload is just static files, and the entry point is index.html. If someone directly opens a route like /shop/jackets, Netlify tries to find a real file or folder with that name inside the build. But such a file does not exist, because React does not create separate HTML files for each route — everything is handled inside index.html by React Router. So Netlify returns a 404 error. Fix: We tell Netlify to always serve index.html for every route, so React Router can read the URL and render the correct page inside the browser i.e. /* /index.html 200 . . . #reactjs #netlify #reactdeployment #nestedroutes
To view or add a comment, sign in
-
Most developers use Next.js. Few use it well. After building production apps for multiple clients, here are 4 Next.js optimizations that actually moved the needle: **1. Parallel Route Fetching** Stop awaiting promises sequentially. Use `Promise.all()` inside Server Components to fetch data simultaneously. I've seen load times drop by 40% with this one change alone. **2. Selective Hydration with Suspense** Wrap non-critical UI in `<Suspense>` boundaries. Your page becomes interactive faster while secondary content loads in the background. Users feel the difference immediately. **3. Route Groups for Clean Architecture** Use `(folderName)` convention to organize your app without affecting the URL structure. Your future self will thank you at 2 AM during a debugging session. **4. Static + Dynamic Hybrid Rendering** Not every page needs the same rendering strategy. Mix `generateStaticParams` with dynamic segments. You get SEO benefits AND real-time data where it matters. The developers shipping the fastest Next.js apps aren't using different tools — they're making smarter decisions about the same tools everyone else has access to. One of these might already be the solution to a performance problem sitting in your codebase right now. Which of these have you implemented? Or is there an optimization I missed that deserves a spot on this list? Drop it in the comments. #NextJS #WebDevelopment #Frontend #ReactJS #JavaScript
To view or add a comment, sign in
-
Memory Leaks in JavaScript Apps A Silent Performance Killer Memory leaks happen when your app keeps using memory that it no longer needs. Over time, this can slow down your website or even crash it Common Causes: • Unused variables still referenced • Forgotten event listeners • Timers (setInterval, setTimeout) not cleared • Detached DOM elements Why It Matters: A small leak might seem harmless, but in long-running apps (like dashboards or SPAs), it can lead to serious performance issues. How to Prevent It: Remove event listeners when not needed Clear timers properly Avoid global variables Use tools like Chrome DevTools Memory tab Pro Tip: Always test your app performance over time, not just at launch! Keep your JavaScript apps fast, clean, and efficient! #JavaScript #WebDevelopment #CodingTips #Frontend #Performance #Developers
To view or add a comment, sign in
-
-
🚀 Hydration in Next.js – SSR vs CSR Explained Simply Ever wondered what "hydration" actually means in Next.js? Think of it like this: The server bakes a complete cake (HTML) and sends it instantly. Hydration is React waking it up on the client — adding state, events, and interactivity. SSR + Hydration (Next.js way): Server renders full HTML → Users see content immediately (great for SEO & speed) JavaScript loads → Hydration turns static HTML into interactive React app Pure CSR: Server sends almost empty HTML Browser does all the rendering with JavaScript Slower first paint, but fully interactive once loaded Next.js gives you the best of both: Fast server-rendered HTML + powerful client interactivity through hydration. Pro Tip: Avoid hydration errors by ensuring server & client render the exact same output. Use useEffect for browser-only code. In the App Router, selective hydration makes it even faster by hydrating only what’s interactive. Have you faced hydration mismatches? Or already using App Router? Let me know in the comments 👇 #NextJS #React #WebDev #SSR #CSR #Frontend
To view or add a comment, sign in
-
-
✅ Module 40 done. Next.js fully unlocked. 🚀 All 10 lessons. ~132 minutes. Here's everything I learned: ✔️ What is Next.js & why it beats plain React for production ✔️ Project structure — app/, layout.js, page.js ✔️ File-based routing — no React Router, ever again ✔️ DaisyUI setup in Next.js ✔️ Dynamic routing with [id] segments ✔️ Multiple nested layouts — no full page re-renders ✔️ Dynamic routing + data loading recap ✔️ Image optimization with <Image /> component ✔️ SEO Metadata API + custom Not Found page + Active Links ✔️ Google Fonts via next/font — zero external CSS Biggest mindset shift: Your folder structure IS your routing. That one idea changes everything. 🤯 Next step: build a real Next.js project. 💪 — #NextJS #ReactJS #WebDev #LearningInPublic #FrontendDev #JavaScript #100DaysOfCode #BuildInPublic #AppRouter #CodeNewbie #DevLife #CodingJourney #ModuleComplete
To view or add a comment, sign in
-
-
✨ 𝗗𝗮𝘆 𝟯 𝗼𝗳 𝗠𝘆 𝗥𝗲𝗮𝗰𝘁 𝗝𝗼𝘂𝗿𝗻𝗲𝘆 ⚛️🚀 Today I learned about 𝗥𝗲𝗮𝗰𝘁 𝗛𝗼𝗼𝗸𝘀, especially the 𝘂𝘀𝗲𝗦𝘁𝗮𝘁𝗲 𝗵𝗼𝗼𝗸 — and this finally made React feel more practical. Before this, I was thinking about how we usually update the UI manually in JavaScript — selecting elements, changing text, updating the DOM step by step. It works, but it can get messy and hard to manage as the app grows. With `𝘂𝘀𝗲𝗦𝘁𝗮𝘁𝗲`, React handles that for us. We just update the 𝘀𝘁𝗮𝘁𝗲, and React automatically updates the UI. No need to manually touch the DOM every time. That shift in thinking was really interesting — instead of telling the browser 𝗵𝗼𝘄 to update, we just tell React 𝘄𝗵𝗮𝘁 the state should be. Starting to see why React is so powerful for building dynamic apps 💻⚡ #ReactJS #JavaScript #WebDevelopment #LearningJourney #FrontendDevelopment
To view or add a comment, sign in
-
-
Is your website losing users before it even loads? 📉⚡ As a Front-End Developer, I’ve learned that a beautiful UI is meaningless if the performance is sluggish. Research shows that even a 1-second delay in page load time can lead to a significant drop in conversions. If you are building with React or Next.js, here are 3 high-impact ways I optimize performance to keep that Lighthouse score in the green: 1️⃣ Smart Image Optimization: Stop serving massive 5MB JPEGs. Use the Next.js <Image /> component for automatic resizing, lazy loading, and serving modern formats like WebP/AVIF. 2️⃣ Code Splitting: Don't make your users download the entire app at once. Use Dynamic Imports or React.lazy() to load components only when they are actually needed. 3️⃣ Memoization: Prevent unnecessary re-renders. Use useMemo and useCallback to cache expensive calculations and functions, keeping your UI snappy. Performance isn't a "one-time task"—it’s a mindset. Building fast apps is just as important as building functional ones. What’s your #1 tip for speeding up a React application? Let’s talk performance in the comments! 👇 #WebPerformance #ReactJS #NextJS #FrontendDeveloper #ProgrammingTips #JavaScript #CodingLife
To view or add a comment, sign in
-
-
🔐 Password Generator Web App 🔗 Live Demo: [https://lnkd.in/gz8PntxP] 💻 Source Code: [https://lnkd.in/g_8JQjiY] Excited to share my latest project — a Password Generator built using HTML, CSS, and JavaScript 🚀 This tool helps users generate strong and secure passwords with customizable options. ✨ Key Features: • Select password length (range control) • Include uppercase letters (A–Z) • Include lowercase letters (a–z) • Add numbers (0–9) • Add special symbols (!@#$...) • Instant password generation 💡 This project helped me strengthen my understanding of JavaScript logic, DOM manipulation, and UI design. Would love your feedback and suggestions! 🙌 #JavaScript #WebDevelopment #Frontend #Projects #Coding
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development