If you are using Next.js, you are likely using <Image />. But many developers misunderstand the sizes attribute, assuming it's used to style the image's physical dimensions on the screen. The sizes attribute actually tells the browser's preload parser how much of the viewport the image will take up at different breakpoints, before the CSS even loads. This allows the browser to download the perfectly sized image from the auto-generated srcset immediately. JavaScript <Image src="/hero.jpg" fill // "On desktop, it's 33vw. On tablets, 50vw. On mobile, 100vw." sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" alt="Hero image" /> If you leave sizes out on responsive images, Next.js defaults to 100vw, forcing desktop users to download massive, bandwidth-heavy files for small thumbnail images. Fix your sizes, and watch your Core Web Vitals improve! #TypeScript #ReactHooks #CodingTips #FrontendEngineering #JavaScript"
Optimize Image Sizes with Next.js for Better Web Vitals
More Relevant Posts
-
Your React or Next.js website is slow. And its 90% your fault. Not the user’s internet. Not the server. Your decisions. Here are 5 common things quietly killing performance: -> Unnecessary re-renders When a parent updates, every child re-renders by default. Your counter changes. Your navbar re-renders. Your sidebar re-renders. Your footer re-renders. Use React.memo for components whose props rarely change. In Next.js, be intentional with "use client". Not everything needs to run on the client. -> Animating the wrong CSS properties Animating width, height, top, or left forces layout recalculations every frame. Prefer transform and opacity — they run on the GPU and are much smoother. -> Layout shifts The page loads. The user starts reading. Then an image appears and pushes everything down. Reserve space for images. In Next.js, always pass width and height. -> Oversized images A 3MB hero image is not design. It’s wasted bandwidth. Use WebP, compress images, lazy load below the fold, and serve responsive sizes. -> Importing entire libraries You needed one icon, but imported the whole library. Now your users download hundreds of files they’ll never see. Import only what you use. Tree-shaking only works if you let it. If your main JS bundle is over approximately 1–2 MB, your app is probably carrying extra weight that slows users down. Trim unused code, lazy load, and optimize assets — your users will notice the difference. Performance isn’t something you “add later.” It’s the result of intentional decisions while building. Most slow apps aren’t complex. They’re just careless. #React #NextJS #WebPerformance #Frontend #JavaScript #WebDevelopment
To view or add a comment, sign in
-
-
Built an Advanced To-Do List Web App using HTML, CSS & JavaScript 🚀 Features: ✔️ Add and delete tasks ✔️ Mark tasks as completed ✔️ Filter: All / Completed ✔️ Data persistence using LocalStorage ✔️ Confirmation before delete This project helped me understand: • DOM manipulation • State management • LocalStorage usage • Dynamic rendering logic Leveling up my frontend development journey 💪 #WebDevelopment #JavaScript #Frontend #LocalStorage #LearningInPublic
To view or add a comment, sign in
-
We use a web browser every single day. But as a Front-End Developer, I asked myself — What actually is a web browser? And how does it work? A web browser is software that allows us to access websites. Examples? Chrome, Edge, Firefox. But here’s what really happens behind the scenes: 1️⃣ You type a URL 2️⃣ The browser sends an HTTP request to the server 3️⃣ The server responds with HTML, CSS, and JavaScript 4️⃣ The browser renders the content on your screen It also: • Parses HTML • Applies CSS styles • Executes JavaScript What feels instant is actually a powerful rendering engine working in milliseconds. Now when I build with React, I don’t just write UI — I understand how the browser interprets it. Fundamentals matter. — Priyanka C Frontend Developer in Progress #WebDevelopment #FrontendDeveloper #WebBrowser #JavaScript #HTML #CSS #ReactJS #SoftwareEngineering #TechLearning #LearningInPublic
To view or add a comment, sign in
-
Hot take: **Next.js 15 server components are not the end of client-side rendering** — but they *do* change the default way we should think about building React apps. For years, many teams defaulted to pushing more and more logic into the browser: - fetch on the client - hydrate everything - ship larger bundles - accept slower initial loads as “normal” Server Components challenge that mindset. With **Next.js 15**, the model is clearer than ever: - render more on the server - send less JavaScript to the client - keep sensitive logic off the browser - improve performance by default That’s a big shift. But let’s be honest: **client-side rendering isn’t going away**. We still need client components for: - interactivity - local state - animations - browser APIs - highly dynamic UI So the real story isn’t “server vs client.” It’s this: **Use the server by default. Use the client when it adds real value.** That’s the promise of modern React architecture: - better performance - cleaner separation of concerns - less JavaScript shipped - better UX without sacrificing rich interactivity The winners won’t be the teams that eliminate CSR completely. They’ll be the teams that stop using it everywhere by default. **Next.js 15 doesn’t kill client-side rendering.** It makes us more intentional about when we use it. What do you think — are Server Components the future of React, or just another layer of complexity? #nextjs #reactjs #webdevelopment #frontend #javascript #servercomponents #performance #softwareengineering
To view or add a comment, sign in
-
Server Components in Next.js 15 are changing how we think about rendering on the web. For years, client-side rendering felt like the default for building modern apps: - fetch in the browser - ship more JavaScript - manage loading states everywhere - accept slower first loads as the tradeoff Next.js 15 keeps pushing a different model forward: ✅ render more on the server ✅ send less JavaScript to the client ✅ fetch data closer to where it’s rendered ✅ improve performance without sacrificing interactivity Does this mean client-side rendering is dead? Not exactly. Client-side rendering still makes sense for: - highly interactive UI - real-time experiences - complex client state - browser-only APIs But the default is shifting. The better question is no longer: “Should I render everything on the client?” It’s: “What actually needs to be on the client?” That’s the real promise of Server Components: use the client only where it adds value, not by default. For teams building with Next.js 15, this can mean: - faster initial page loads - smaller bundles - simpler data fetching patterns - a cleaner separation between server and client logic We’re moving toward a web where JavaScript is used more intentionally. Not the end of client-side rendering. Just the end of using it everywhere. #nextjs #react #webdevelopment #frontend #javascript #servercomponents #performance #softwareengineering #WebDevelopment #TypeScript #Frontend #JavaScript
To view or add a comment, sign in
-
-
Day 3/30 – Event Countdown Timer Continuing my 30 Days – 30 Frontend Projects Challenge, today I built a countdown timer web app using HTML, CSS, and JavaScript. Features: • Real-time countdown (Days, Hours, Minutes, Seconds) • Clean and responsive UI layout • JavaScript logic updating every second • Simple and practical event tracking tool This project helped me practice time calculations, DOM updates, and interactive UI components. 🌐 Live Demo: https://lnkd.in/g2cVCzTF Consistency is key on to Day 4 tomorrow #snsinstitutions #snsdesignthinkers #designthinking #30DaysOfCode #FrontendDeveloper #WebDevelopment #JavaScript #StudentDeveloper
To view or add a comment, sign in
-
-
Day 73 of me reading random and basic but important dev topicsss.... Today I read about the Lost Art of Popups & the Browser Gatekeeper ..... As frontend engineers, we’re obsessed with seamless SPAs, modals, and dynamic rendering. But sometimes, what we need is true isolation and that’s where the classic Popup Window comes in. While popups are an ancient artifact of the early web, they are still a critical tool for specific modern use cases like OAuth flows (Google/Facebook login) or detached secondary tools. Why? Because a popup runs in its own independent JavaScript environment, making it a safe sandbox for interacting with untrusted or third-party origins. The Golden Rule of Popups: The Blocker In the early 2000s, popups were abused relentlessly by ad networks. To counter this, browsers introduced aggressive popup blockers. Today, the rule is simple: Browsers will block any popup that is NOT triggered by a direct user action. Blocked: // Runs on load or inside an async callback window.open('https://example.com'); Allowed: // Synchronously bound to user intent button.onclick = () => { window.open('https://example.com'); }; The window.open Arsenal The syntax is window.open(url, name, params). * url: The destination. * name: The target name. (Pro-tip: If you use the same name multiple times, it will refresh the existing popup rather than spawning endless new windows!) * params: A comma-separated string of configurations (no spaces!). Keep Learning!!!!! #JavaScript #WebDevelopment #FrontendDev #SoftwareDevelopment
To view or add a comment, sign in
-
-
If you ever want to instantly humble a modern web developer, just ask them to build a complex page layout using only HTML <table> tags. The history of the web is basically a comedy of errors that we somehow duct-taped into a functional, billion-dollar ecosystem. Looking back at the "dark ages" of front-end development is wild. We went from using invisible spacer GIFs and <marquee> tags just to make a page look decent, to having the absolute luxury of CSS Flexbox, Grid, and component-based architectures like JSX. It is incredibly easy to get burnt out on modern framework fatigue and the endless parade of new tools. But whenever I get frustrated with a stubborn piece of state logic or a rogue CSS class, I just remember that at least I don't have to nest seven tables deep just to center a button anymore. What was the very first web technology or HTML tag you learned that is now completely obsolete? Let me know below! 👇 #WebDevelopment #FrontendEngineering #TechHistory #JavaScript #CodingLife
To view or add a comment, sign in
-
Excited to unveil Instant Weather – my latest single-file weather app with a cyberpunk neon glow! No API keys, pure frontend magic. 🌌 Save as index.html, enter "Chennai" or "Warangal", hit Enter – boom! Live temp, humidity, wind via wttr.in's free JSON API. Tech Stack: Tailwind CSS + Space Grotesk font Custom gradients & neon text-shadows Responsive Bento-style cards Enter-to-search + loading states Try it live: https://lnkd.in/gGdez7zt #WebDevelopment #TailwindCSS #JavaScript #Frontend #PortfolioProject #BTechProjects
To view or add a comment, sign in
-
🎲 Dice Roller Web App I built a simple Dice Roller application using HTML, CSS, and JavaScript. 🔹 Features: • Roll a virtual dice with a single click • Generates a random number between 1 and 6 • Dynamic dice image update using JavaScript • Simple and interactive UI This project helped me practice JavaScript logic, DOM manipulation, and basic frontend development. In dice-roller apps, JavaScript usually generates a random number and updates the interface when the user clicks the roll button. 🔗 Live Project: https://lnkd.in/dxGvnd7b #JavaScript #HTML #CSS #WebDevelopment #FrontendDeveloper #Projects
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