Manipulating DOM with useRef: The Right Way to Escape React
A complete guide to accessing DOM directly in React using useRef, avoiding common pitfalls, and mastering advanced patterns like forwardRef and useImperativeHandle.

Writing about development and technology.
A complete guide to accessing DOM directly in React using useRef, avoiding common pitfalls, and mastering advanced patterns like forwardRef and useImperativeHandle.

A deep dive into why environment variables return undefined in Vite and how to fix it. Covering bundler mechanics, security models, dynamic injection in Docker/CI, and Monorepo setups.

React generally favors unidirectional data flow, but sometimes parents need to command children. Learn how to expose specific methods using useImperativeHandle while maintaining encapsulation.

Understanding stacking context to fix z-index issues.

Fixing the memory leak warning caused by calling setState after a component has been removed.

Fixing the crash caused by props coming through as undefined from the parent component.

How closures referencing outdated values caused bugs in my React app, and how I fixed them.

My experience getting stuck in an infinite loop due to useEffect dependency arrays, and how I escaped.

You changed the code, saved it, but the browser does nothing. Tired of hitting F5 a million times? We dive into how HMR (Hot Module Replacement) works, why it breaks (circular dependencies, case sensitivity, etc.), and how to fix it so you can regain your development speed.

Stop running `kubectl apply` manually. We explain GitOps, where Git becomes the Single Source of Truth for your infrastructure. Learn the difference between Push vs Pull deployments, how tools like ArgoCD automate synchronization, strategies for handling secrets in Git, and how to detect when someone manually changes your cluster configuration (Drift).

You added the file to .gitignore, but Git keeps tracking it. Is Git broken? No, you just missed the golden rule. We explain Git's tracking logic using a 'Club Blacklist' analogy and show you how to evict unwanted files using `git rm --cached` without deleting your local data.

It's 3 AM. You essentially just handed your AWS keys to every bot on the internet. Panicking and deleting the file won't save you because Git remembers everything. We walk through the specific steps to scrub sensitive data from history using `git reset`, how to apologize gracefully with `git revert`, and how `git reflog` can save you when you accidentally delete your work.

Passing a ref to a child component isn't as simple as passing a prop. We dive into why React throws warnings, how `forwardRef` acts as a tunnel for DOM access, and how `useImperativeHandle` allows you to expose a controlled API instead of the raw DOM node, enforcing better encapsulation.

React forms can get sluggish with just 50 inputs. Why? Because of global state re-renders. We explore the journey from a laggy `useState` monolith to a performant, uncontrolled component architecture using React Hook Form, discovering the power of isolation and debouncing along the way.

I updated the database, but the page still shows old data. We analyze the powerful (and evil) caching mechanism of Next.js 13+ in 4 layers, compare it with React Query, and share practical debugging strategies.

Deleting 500 lines of loading states with React Suspense. How to handle async UI declaratively.

Class is there, but style is missing? Debugging Tailwind CSS like a detective.
