Nirajan Basnet 🇳🇵 (@nirazanbasnet) header
Nirajan Basnet 🇳🇵 (@nirazanbasnet) profile picture

Frontend Developer | Tech enthusiast | Blogger

Kathmandu
Joined February 2013
Photo by Nirajan Basnet 🇳🇵 (@nirazanbasnet)Photo by Nirajan Basnet 🇳🇵 (@nirazanbasnet)Photo by Nirajan Basnet 🇳🇵 (@nirazanbasnet)Photo by Nirajan Basnet 🇳🇵 (@nirazanbasnet)
Most Mac cleaners are a one-way door. I build sparebyte.app/ which moves everything to the Trash and keeps a 7-day Undo. Deleted the wrong thing? One click and it's back. I priced Sparebyte as a one-time purchase of $15 as an early bird, not a subscription.
49
The useSyncExternalStore hook rescued me from a silent UI glitch—its guarantees keep the UI on the latest value even when React batches updates, dodge stale‑closure traps, and work unchanged in concurrent mode. #react #frontend
1
43
The URL class can shave minutes off every debug session. Instead of juggling “?” “&” and regexes, just do new URL(location.href).searchParams—read, add or delete params in one line, no off‑by‑one bugs. Still hand‑crafting query strings? #frontend #javascript
24
Pub/Sub isn't just for microservices. Using an event broker in my frontend: • ↓30% modal code • No prop drilling • Flatter component tree • New features without touching existing code One broker. Many listeners. Loosely coupled UI. #frontend #javascript
1
24
Viral AI dev tools hype distracts us: real productivity still comes from offline work. Use local, version‑pinned runners and a single npm test to verify, treating scaffolds as a start, not a finish. What will you move back to your machine this week? #ai #productivity
1
1
38
Use optional chaining (?.) and nullish coalescing (??) to write cleaner, safer JavaScript. ?? only falls back on null or undefined, preserving 0 and "". #javascript #frontend
1
23
MCP lets AI coding agents treat your local repo like their own IDE—streaming the workspace tree so they query files on demand instead of loading everything. Real‑time lookups cut token use, keep context in sync with your branch. What edge cases have you seen? #ai #devtools
1
1
67
AI agents review PRs faster than a senior dev on a coffee break. I’m testing a lightweight LLM that flags style violations as you type. Use it as a pre-commit guard, run on every push, keep rules simple, and let the team focus on architecture. What rule would you automate first?
1
16
Composite pattern flattens tree UI: treat every button, menu, modal as a leaf or container sharing one render contract. No special cases, just one call that walks the tree. Add new UI elements without touching existing code. What leaf have you turned into? #designpatterns
23
UI libraries evolve fast. Three open-source design systems stand out: lightweight bundles, accessibility-first, and runtime theming with typed APIs. What's your top priority when choosing a UI kit? #frontend #designsystems
1
1
27
Intl API is the only way to guarantee locale‑correct dates and numbers without pulling in a huge library. Use a reusable Intl.NumberFormat or Intl.DateTimeFormat per locale at app init to avoid re‑creating them on every render. #javascript #tips
1
29
CSS subgrid stops you fighting the parent grid just to line up inner items. Swap a nested 12‑column grid for display: subgrid and it inherits the column tracks, aligning perfectly without extra media queries—one line of CSS, no JavaScript, works in Chrome and Safari 16+. #css
33
A thin facade can reduce coupling. Wrap only the library calls you use, so updates happen in one place—not across dozens of imports. Clear contracts, easier testing, fewer breaking changes. Do facades simplify your code or add unnecessary complexity? #softwarearchitecture #js
173
Memoization can turn expensive operations into near-instant responses. Cache repeated results, use a Map for O(1) lookups, limit cache size, and invalidate when data changes. What's your best memoization win? #performance #javascript
13
CSS subgrid ends the “nested grids fighting over alignment” nightmare. Drop wrapper divs, let the child grid inherit parent tracks and get one source of truth for column widths. One line replaces dozens of hacks. tried it? #css #webdev
10
cascade layers (@layer) let you rewrite CSS specificity like version control. Keep tokens in one file, add a @layer per component library. Browser resolves conflicts by layer order, not selector depth
1
43
CSS can animate on scroll with zero JavaScript. Modern browsers support scroll‑timeline and view‑timeline, turning scroll position into a timeline you attach to a CSS animation. Less bundle weight, no listeners, smoother compositor‑driven performance. #css #webdev
1
30
Container queries will outlive media queries because letting components adapt to their own space—instead of a global viewport—makes layouts modular, shrinks CSS, and speeds up shipping. What layout pain would vanish if you could query the container instead of the screen? 👇 #CSS
11
CSS clamp() can replace dozens of media queries for fluid typography. Swap fixed sizes for clamp(1rem,2.5vw,2rem) and the page adapts to every viewport without a single breakpoint. One line per text element, lean CSS, less jitter. Have you tried clamp() for type? #css #webdev
1
45