5 React patterns I use in production
After building several apps in the ecosystem, these are the React patterns I repeat the most. Nothing exotic โ things that scale and don't betray me three months later.
1. Custom hooks for logic, not for everything
One hook per concern. If a hook does three things, that's three hooks.
function useDebouncedValue<T>(value: T, ms = 300): T {
const [v, setV] = useState(value)
useEffect(() => {
const id = setTimeout(() => setV(value), ms)
return () => clearTimeout(id)
}, [value, ms])
return v
}
2. Derived state, not duplicated
If you can compute it, don't store it in state. Fewer useState, fewer sync bugs.
Rule: every piece of state should have a single source of truth.
3. Dumb components + containers
The UI shouldn't know where the data comes from. That makes wiring up a CMS or an API later trivial.
4. Zustand for lightweight global state
Redux is a lot for most apps. Zustand gives 90% with 10% of the ceremony.
5. Suspense + lazy for the weight
Lazy loading per route and per heavy component. The first render has to fly.
None are magic. Together they make today's code kind to future me.
// related articles
Case Study
Building ORVEXIA Browser: an AI-native, privacy-first browser
How I unified backend, UI and design system in a single Electron project with 17 services, 104 IPC channels, an encrypted vault and multi-provider AI.
Learning
Trading with discipline: my TRADER system
I study the markets with an Interactive Brokers account and a clear framework: Technique, Risk, Analysis, Discipline, Strategy and Reward.
โ Anterior
ORVEXIA YouTube: building in public
Siguiente โ
The ORVEXIA ecosystem: how it all connects
// newsletter
Did you like it? Get the next article from the ORVEXIA ecosystem.
// comments
For now, write to me: orvexiainnovativepro@yahoo.com