BitlystBitlyst
PostsSeriesTopicsAbout

Bitlyst

Short, diagram-first posts on JavaScript, React & Next.js. Follow via RSS or the newsletter.

© 2026 Mohsen Fallahnejad

PostsSeriesTopicsLinksAboutRSSGitHubX
← All topics

#react

19 posts

The Server Action That Ran Twice, but Only on localhost

Why a Next.js Server Action called from useEffect runs twice in development: React Strict Mode mounts every component twice. What that reveals, and where the call belongs.

Nov 3, 20264 min read

I Optimized a Button From O(n) to O(1). The Speed Didn't Matter.

A bug report, a route map, and three rounds of making it faster — a story about what Big O really measures, why constants win at small n, and why the best algorithm is sometimes deleting the question.

Oct 31, 202610 min read6

React useEffect Dependencies — The Bug That Keeps Coming Back

Why your effect reads old state, fires twice, or loops forever — and the simple rules to fix it (interview-ready).

Jul 8, 20266 min read1

React memo vs useMemo vs useCallback — When to Use Which

Three React APIs that all say 'memoize' — but they do different things. Clear explanations, examples, and a cheatsheet.

Jun 28, 20263 min read

useDeferredValue Explained: Keeping React UIs Responsive

How useDeferredValue works under the hood, when to use it, and how it differs from useTransition.

Dec 12, 20251 min read

useTransition Explained: Make React Feel Instant

How useTransition works under the hood, when to use it, and how it differs from useDeferredValue.

Dec 12, 20253 min read

React Fiber Explained: How React’s Engine Actually Works

A deep but clear explanation of React Fiber — the engine that powers modern React rendering and concurrency.

Oct 8, 20254 min read5

React Context Explained: How It Works Under the Hood

Understand what React Context is, how it works internally, and best practices for using it effectively.

Oct 6, 20253 min read

Why setState Doesn’t Cause Hydration Errors

Understanding why calling setState after hydration doesn’t produce hydration mismatches in React/Next.js.

Sep 26, 20252 min read

AbortController & AbortSignal

Everything you need to cancel async work in JS: fetch, streams, custom tasks, React patterns, Node notes, timeouts, races, and common pitfalls.

Sep 23, 20254 min read

How useState Works Under the Hood (and Why It Needs use client)

Deep dive into React's useState, how it works internally, and why client components are required in Next.js App Router.

Sep 23, 20254 min read

What is 'use client' in Next.js?

Understand 'use client' in Next.js App Router: what it means, when to use it, and how it works under the hood.

Sep 23, 20252 min read

Next.js Page Router vs App Router

Understand the key differences between the old Page Router and the new App Router in Next.js.

Sep 23, 20252 min read

JavaScript Event Bus 🚍 (JS + TypeScript)

A polished, practical event bus pattern with minimal JS, a strongly-typed TS version, wildcards, once-handlers, and React usage tips.

Sep 21, 20254 min read1

React Higher-Order Components (HOC)

Understand Higher-Order Components (HOCs) in React with examples, use cases, downsides, and a comparison to hooks.

Sep 21, 20252 min read

React useRef vs useState — When to Use Which

A simple guide to understanding when to use useRef and useState in React, with examples, mental models, and a quick cheatsheet.

Sep 17, 20252 min read

When Should You Use Dynamic Import in React/Next.js? (With Performance Comparison)

A practical guide to dynamic imports with real-world examples and a before/after bundle-size comparison using next-bundle-analyzer.

Sep 17, 20253 min read1

Frontend Design Patterns — A Practical Guide

A concise, example‑driven overview of the most useful frontend patterns for modern React/Next.js apps.

Sep 15, 20254 min read1

MVVM, Micro‑Frontends, and Domain‑Driven Frontend — A Practical Guide

Clear, practical explanations of MVVM, micro‑frontends, and domain‑driven design for modern React/Next.js teams, with examples, folder structures, and trade‑offs.

Sep 15, 20256 min read

Related topics

#frontend#nextjs#hooks#performance#architecture#concurrent#javascript#use client