React, made visible. Five small demos of the React and JavaScript ideas every frontend developer should know. Each page has one control and a live text log: click, read what happened, and see the difference side by side.
Live demo: add your Cloudflare link here
| # | Page | Try it | What the log shows |
|---|---|---|---|
| 1 | Re-renders | "Re-render the parents" | Without optimisation the child renders every time; with React.memo + useCallback it is skipped |
| 2 | State management | Pick useState / Context / Redux Toolkit / Zustand, click +1 | Which parts re-render with each approach, and whether the count survives leaving |
| 3 | Debounce vs throttle | Type in a search box | Every keystroke vs throttled calls vs the single debounced call |
| 4 | Promises | Pick all / allSettled / race / any, press Run |
When each fake API call settles and when (and how) the combined promise settles |
| 5 | Virtual list | Choose 1,000 / 10,000 / 1,00,000 rows and scroll | Only ~15 rows exist in the DOM, whatever the list size |
Every page follows the same layout: concept → try it → the difference (table) → key takeaway → the real source code.
React 19 · React Router (createBrowserRouter with lazy routes) · Redux Toolkit · Zustand · CSS Modules · Vite · Vitest · Cloudflare Workers
- Route-level code splitting: each page is a
lazyroute, so Redux and Zustand only download on the state page. - A tiny external store for the logs (
useSyncExternalStore), so writing "X rendered" never causes the renders being measured. - StrictMode-safe render logging: counts only renders React committed, so development and production match.
- Debounce and throttle written from scratch, with hooks that avoid stale callbacks and cancel timers on unmount. The virtual list reuses the throttle hook.
- Stale-result protection in the promise demo: results from an older run are ignored.
- Hand-written virtualisation with a tested
getVisibleRange()function. - Accessible: skip link, labelled controls, radio groups with ARIA roles, logs announced with
aria-live.
npm install
npm run dev # http://localhost:5173
npm test # 8 unit tests
npm run build # production build in dist/src/
main.jsx renders <App />
App.jsx provides the router (<RouterProvider>)
app/ router, layout + sidebar, home page, error and 404 pages
components/ DemoPage, EventLog, CodePanel, shared ui styles
lib/ eventLog (tiny store) and useRenderLog hook
demos/
rerenders/ RerenderDemo
state/ four counter versions + shared parts
timing/ debounce, throttle, useRateLimited hooks
promises/ runner + page
virtual/ getVisibleRange + VirtualList
styles/ tokens.css, global.css
tests/ debounce, throttle, getVisibleRange, eventLog
wrangler.jsonc serves dist/ as static assets with single-page-application fallback, so refreshing any page works.
- From GitHub: Cloudflare dashboard → Workers & Pages → Create → Import a repository → build command
npm run build, deploy commandnpx wrangler deploy. - From your computer:
npx wrangler loginonce, thennpm run deploy.
netlify.toml and vercel.json are included too.
Built by Suprakash Ballav.

