The DOM is officially a bottleneck. 🤯 Cheng Lou (former React core team) just dropped Pretext, and it is challenging how browsers have handled text layout for the past 30 years. For decades, figuring out how much space a paragraph occupies meant rendering it in the browser and measuring it. This triggers layout reflows (using tools like getBoundingClientRect), which is one of the most expensive and thread-blocking operations in web development. Enter Pretext: A pure JavaScript/TypeScript library that handles multiline text measurement without touching the DOM. Here is why it is so powerful: Instead of relying on CSS rendering, it uses an off-screen Canvas and a clever two-phase API (prepare() and layout()) to pre-calculate word sizes using pure arithmetic. The layout operations run in roughly 0.09ms. It natively supports platform-specific emojis, complex text directions (RTL), and different languages. It enables previously impossible UI effects, like text fluidly wrapping around moving, draggable obstacles in real-time. The project rocketed past 10,000 GitHub stars in just days because it solves a massive performance hurdle for the next generation of spatial and interactive UIs. #WebDevelopment #JavaScript #TypeScript #Frontend #SoftwareEngineering #TechNews #UIUX
More Relevant Posts
-
🎨 My Frontend & Design Stack These are the technologies I use to build everything you see on screen. The visual layer, the interactions, and the structure of every app I create. 🌐 HTML5 — The skeleton of every webpage. Semantic structure that makes sites accessible and SEO-friendly. 🎨 CSS3 — The styling engine. Controls layout, spacing, colors and animations to make UIs look polished. ⚡ JavaScript — The brain of every interactive experience. Logic, events, and dynamic content. 🔷 TypeScript — JavaScript with strong typing. Catches bugs early and makes code more reliable. ⚛️ React.js — My core UI library. Reusable components and state management on every frontend I build. ▲ Next.js — The full-stack React framework. Fast, SEO-friendly, and production-ready out of the box. 💨 Tailwind CSS — Utility-first styling I use on every single project. Clean, fast and fully responsive. 🎬 Framer Motion — Smooth animations and micro-interactions that make UIs feel alive. Which of these do you use? Drop it below 👇 #MansurbCodes #Frontend #WebDevelopment #ReactJS #NextJS #JavaScript #TypeScript #TailwindCSS #FramerMotion #WebDesign #PakistaniDeveloper #Coding #LearnToCode
To view or add a comment, sign in
-
-
💡 Understanding a subtle React concept: Hydration & “bailout” behavior One interesting nuance in React (especially with SSR frameworks like Next.js) is how hydration interacts with state updates. 👉 Hydration is the process where React makes server-rendered HTML interactive by attaching event listeners and syncing state on the client. When a page is server-rendered, the initial HTML is already in place. During hydration, React attaches event listeners and syncs the client state with that UI. Here’s the catch 👇 👉 If the client-side state matches what React expects, it may skip updating the DOM entirely. This is due to React’s internal optimization often referred to as a “bailout”. 🔍 Why this matters In cases like theme handling (dark/light mode): If the server renders a default UI (say light mode ☀️) And the client immediately initializes state to dark mode 🌙 React may still skip the DOM update if it doesn’t detect a meaningful state transition 👉 Result: UI can temporarily reflect the server version instead of the actual state. 🧠 Conceptual takeaway A more reliable pattern is: ✔️ Start with an SSR-safe default (consistent with server output) ✔️ Then update state after hydration (e.g., in a layout effect) This ensures React sees a real state change and updates the UI accordingly. 🙌 Why this is fascinating It highlights how deeply optimized React is — sometimes so optimized that understanding its internal behavior becomes essential for building predictable UI. Grateful to the developer community for continuously sharing such insights that go beyond surface-level coding. 🚀 Key idea In SSR apps, correctness isn’t just about what state you set — it’s also about when React observes the change. #ReactJS #NextJS #FrontendDevelopment #WebDevelopment #JavaScript #Learning
To view or add a comment, sign in
-
-
I just published my npm package: @vishal4500/rich-text-editor While working on real-world projects, I often needed a powerful yet customizable rich text editor that works smoothly with React and Next.js—so I built one. Key highlights: • Built with React + Tiptap • Full formatting toolbar (fonts, colors, alignment, lists, tables) • Resizable images + link support • Outputs both HTML & JSON • SSR-safe (works with Next.js without hydration issues) • Scoped styling (no conflicts with your design system) • TypeScript support (ESM + CJS) Easy to use: npm install @vishal4500/rich-text-editor This package is designed to be plug-and-play, but also flexible enough for complex applications. Would really appreciate your feedback or suggestions 🙌 If you're building something with React, feel free to try it out. #reactjs #javascript #webdevelopment #frontend #opensource #npm #nextjs #typescript #tiptap #richtexteditor #ui #ux #softwareengineering #webdev #developers
To view or add a comment, sign in
-
🚀 CSS is evolving fast — and these new updates are game-changers for frontend developers. Here are 3 powerful additions you should know: 🔹 If-else in CSS – Write conditional styles without complex media queries 🔹 corner-shape – Create advanced shapes without relying on clip-path 🔹 @scope – Keep your styles clean and avoid global conflicts These features help write cleaner, more maintainable, and scalable CSS. 💡 If you're building modern UIs, it's time to start experimenting with these. Which one are you excited to try first? 👇 #FrontendDevelopment #CSS #WebDevelopment #SoftwareEngineering #UIUX
To view or add a comment, sign in
-
-
**Next.js 15 Server Components — the end of client-side rendering?** Not quite. But it *does* feel like a major shift in how we build for the web. For years, frontend development leaned heavily on client-side rendering: - ship more JavaScript - fetch data in the browser - hydrate everything - hope performance holds up With **Server Components in Next.js 15**, the default mindset is changing: ✅ Fetch data on the server ✅ Keep sensitive logic off the client ✅ Send less JavaScript to the browser ✅ Improve performance and initial load times That’s a big deal. But let’s be clear: **client-side rendering isn’t dead**. We still need client components for: - interactivity - local state - animations - browser-only APIs - rich UI experiences What’s really happening is this: **We’re getting better boundaries.** Instead of treating the entire app like it needs to run in the browser, we can now choose: - **Server Components** for data-heavy, static, and secure parts - **Client Components** for interactive UX That means better performance *and* cleaner architecture. The real question isn’t **“Is this the end of client-side rendering?”** It’s: **“Why were we rendering so much on the client in the first place?”** Next.js 15 doesn’t kill CSR. It makes it **intentional**. And that’s probably the bigger evolution. #nextjs #react #webdevelopment #javascript #frontend #performance #servercomponents #fullstack #WebDevelopment #TypeScript #Frontend #JavaScript
To view or add a comment, sign in
-
-
One styling approach I’ve been using in React.js applications ⚛️ Combining CSS Modules with Tailwind CSS works really well for scalable frontend development. Here’s why: • Scoped styling → avoids class conflicts • Faster UI development using utility classes • Clean and modular component-based structure • Easy to build responsive layouts This approach helps in building maintainable and high-performance applications. What’s your preferred styling approach in React? 🤔 #ReactJS #FrontendDeveloper #TailwindCSS #WebDevelopment #JavaScript
To view or add a comment, sign in
-
-
🚀 Ever wondered why React split react and react-dom into separate packages? At first glance, it feels redundant, but it’s actually a very smart design decision. 💡The core idea: Separation of concerns react = the brain 🧠 react-dom = the renderer 🌐 🧠 react (Core Library) Handles what your UI should look like: • Components • State & props • Hooks • Reconciliation logic 👉 It’s platform-agnostic (doesn’t care where you render) 🌐 react-dom (Renderer) Handles how to render on the web: • DOM updates • Event handling • Browser-specific logic 👉 It connects React’s logic to the actual browser ⚡ Why this split matters 🔌 1. Multi-platform support Same React → different renderers • Web → react-dom • Mobile → React Native • Others → custom renderers 🧩 2. Flexibility & Extensibility You can build your own renderer (Canvas, WebGL, etc.) 🚀 3. Cleaner architecture Logic stays separate from platform-specific implementation 🧠 4. Enabled major internal upgrades (like Fiber) Because rendering is decoupled from core logic, React was able to introduce Fiber (its new reconciliation engine) without forcing major changes on developers. 👉 Same API, better performance under the hood. 🧠 In one line: React focuses on what to render, react-dom handles where and how to render it 💬 Ever thought about this before, or just imported both without questioning it? #ReactJS #Frontend #JavaScript #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
I used to copy-paste the same layout across multiple pages… and didn’t realize how much time I was wasting. Day 4 of my 30-day Next.js deep dive. Today I explored layouts and nested layouts in Next.js. It seems like a small concept—but it completely changes how you structure a real application. Instead of repeating UI, you define it once and reuse it smartly. Key Learnings - Layouts allow you to share common UI (like navbar, footer) across pages - Nested layouts help structure complex apps with different sections - Each route can have its own layout without affecting others - Keeps code DRY and easier to maintain - Makes scaling large applications much more manageable At first, I thought layouts were just about avoiding repetition. But while working through it, I realized: 👉 It’s actually about thinking in structure, not pages Instead of building isolated pages, I started thinking: “How should this app be organized as a whole?” That shift made everything feel more like real-world development. I’m learning to focus not just on building features—but on structuring applications in a clean and scalable way. Because in remote teams, readability and maintainability are just as important as functionality. How do you usually approach layout structure in your projects—plan first or adjust as you go? #NextJS #WebDevelopment #ReactJS #FullStackDeveloper #JavaScript #CleanCode #LearningInPublic #RemoteDeveloper
To view or add a comment, sign in
-
-
Tired of building UI from scratch every time… So I built my own Component Library ⚡ 🔗 GitHub: https://lnkd.in/gz_vRwND 🔗 Vercel: https://lnkd.in/gjwbZbcA ✨ Built with React + Tailwind ✨ Clean & reusable components ✨ Live preview + copy code ✨ Dark mode + responsive How to use: 1. Browse components 2. Click "Show Code" 3. Copy & paste into your project 4. Customize as needed “Browse → Copy → Use → Customize” This project helped me improve: UI design thinking Component reusability Real-world frontend skills Still improving it — feedback is welcome 🙌 #ReactJS #TailwindCSS #FrontendDeveloper #WebDevelopment #UIUX #JavaScript #OpenSource #100DaysOfCode #Developer #Portfolio
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