Frontend
The part of the app people see: React, Vite, Tailwind and shadcn/ui, the browser errors that break it, and making it fast, installable and pleasant on a phone.
99 posts · page 2 of 4
useMemo vs useCallback (and React.memo): When Memoization Helps
useMemo caches a computed value; useCallback caches a function; React.memo skips re-rendering a component whose props didn't change. When each actually helps, when it's wasted effort, the dependency array rules, and how the React Compiler now does most of this for you.
"Unexpected Token < in JSON at Position 0": What It Means and How to Fix It
Your code expected JSON and got HTML — almost always an error page or your app's index.html. Why it happens (wrong URL, 404, server error, SPA fallback, login redirect), how to see what the server actually sent, and how to parse responses safely.
"A Component Is Changing an Uncontrolled Input to Be Controlled": Fix
React warns when an input's value starts as undefined and later becomes a string. What controlled and uncontrolled inputs are, why undefined initial state causes this, and the fixes: initialise with '', use ?? '' for loaded data, and handle checkboxes and selects properly.
TypeScript Generics Explained (Without the Headache)
Generics let a function, type or component work with many types while keeping type safety — like 'a list of T'. How <T> works, inference, constraints with extends, keyof, default type parameters, generic React components and hooks, utility types like Partial and Pick, and when generics are overkill.
type vs interface in TypeScript: Which Should You Use?
type aliases and interfaces both describe object shapes, and mostly behave the same. The real differences — unions and other non-object types, declaration merging, extends vs intersections, error messages — and a simple, consistent rule for choosing in your codebase.
TypeScript "Type X Is Not Assignable to Type Y": How to Read and Fix It
TypeScript's most common error means a value doesn't match the type expected where you put it. How to read the message (including long nested ones), the common cases — string vs number, null and undefined, string literals, missing object properties, array types — and fixes that don't just hide the bug.
Tauri vs Electron: Building Desktop Apps With Web Technology
Electron and Tauri both turn a web app into a desktop app for Windows, macOS and Linux. Electron bundles Chromium and Node.js; Tauri uses the system's web view and a Rust back end. How they compare on app size, memory, consistency, security, mobile support and learning curve.
TanStack Query vs useEffect for Data Fetching in React
Fetching in useEffect looks simple until you need loading states, errors, caching, race conditions, refetching and mutations. What TanStack Query handles for you, side-by-side code, mutations with invalidation, and when server components or plain useEffect are still the right choice.
Tailwind vs Bootstrap: Which CSS Framework Should You Use?
Bootstrap gives you ready-made components with a recognisable look; Tailwind gives you small utility classes to build any design. How they differ in approach, file size, customisation, learning curve and AI-tool support, with the same button in both, and how to choose.
Streaming LLM Responses to the Browser: SSE, Fetch Streams, and Gotchas
Streaming makes AI features feel fast: words appear as they're generated instead of after a ten-second wait. How to stream from the Claude API on your server, forward it to the browser, read it in React, and fix the proxies and timeouts that buffer or cut off streams.
SSR vs CSR vs SSG: How Web Pages Get Rendered, Explained
Server-side rendering, client-side rendering and static site generation are three answers to one question: where and when is the HTML made? How each works, the trade-offs for speed, SEO, cost and freshness, ISR in between, and which to use for which page.
SPA vs MPA: Single-Page vs Multi-Page Applications Explained
A single-page app loads once and swaps content with JavaScript; a multi-page app loads a new HTML page for each link. How each works, what it means for speed, SEO, hosting and complexity, and why modern frameworks like Next.js and Astro blur the line.
Semantic HTML: What It Is and Why It Matters (With Examples)
Semantic HTML means using tags that describe what content is — header, nav, main, article, button — instead of divs for everything. Why it matters for accessibility, SEO and maintainability, the tags to know, and the div-soup mistakes AI-generated code often makes.
Schema Markup Explained: Structured Data for SEO (With JSON-LD Examples)
Schema markup is code that tells search engines what your page is about — an article, a product, a business, an FAQ — in a format they understand exactly. What it does, JSON-LD examples for common types, adding it in Next.js, testing it, and what it can and can't do for rankings.
React vs Vue vs Svelte: Which Frontend Framework Should You Learn?
Three popular ways to build interactive web interfaces. How they differ in syntax, size, learning curve, ecosystem and jobs — and why, if you build with AI tools, the answer is usually React even when another option is nicer.
React useState Explained: How State Actually Works
useState gives a component memory that survives re-renders and updates the screen when it changes. How it works, why the value doesn't change immediately after you set it, updating objects and arrays without mutating them, and the functional update form.
React useEffect Explained: When to Use It (and When Not To)
useEffect runs code after React renders, to sync your component with something outside React — a timer, a subscription, a browser API. How the dependency array works, cleanup functions, why effects run twice in development, and the many cases where you don't need an effect at all.
"Each Child in a List Should Have a Unique Key Prop": What It Means
React's key warning appears when you render a list without telling React which item is which. Why keys matter, why array index is a bad key for lists that change, what to use instead, and how to fix the warning in fragments and nested maps.
React "Too Many Re-renders" and "Maximum Update Depth Exceeded": Fixes
Both errors mean a component keeps updating state, which re-renders it, which updates state again — forever. The four patterns that cause it (calling a handler instead of passing it, setState during render, effects without dependencies, objects in dependency arrays) and their fixes.
React State Management: useState vs Context vs Zustand vs Redux
Most React apps need less state management than they think. Sort your state into server, URL, form, local and global, then pick the lightest tool for each: useState, the URL, React Context, Zustand, Redux Toolkit or Jotai. Trade-offs, examples and common mistakes.
React Server Components Explained: "use client", "use server", and What Runs Where
Server Components render on the server and send no JavaScript; Client Components hydrate in the browser for interactivity. How the boundary works, what 'use client' and 'use server' actually mean, passing data across, common errors, and how to keep secrets and bundles where they belong.
React Props Explained: Passing Data Between Components
Props are how a React component receives data from its parent — like arguments to a function. How to pass and read them, destructuring and defaults, passing functions and children, props vs state, and the common mistakes that cause bugs.
React Hook Form: Fast, Validated Forms With Less Code
React Hook Form manages form state with uncontrolled inputs, so big forms stay fast and the code stays short. register, handleSubmit, errors, Zod validation with zodResolver, Controller for UI libraries, field arrays, server errors, and using it with Next.js Server Actions.
React Error Boundaries: Stop One Broken Component Crashing the Page
Without an error boundary, one component throwing during render blanks your entire React app. How error boundaries work, using react-error-boundary with fallbacks and reset, Next.js error.tsx and global-error.tsx, what boundaries don't catch, and reporting errors to monitoring.