Skip to content

Instantly share code, notes, and snippets.

View Abdulrezak-halid's full-sized avatar
🥶

Abdulrezak Halit Abdulrezak-halid

🥶
View GitHub Profile
@Abdulrezak-halid
Abdulrezak-halid / useMemo-when-to-use.tsx
Last active January 2, 2026 18:14
React Performance - useMemo
import { useMemo } from "react";
/**
* useMemo – When and Why to Use It
*
* ✅ Use useMemo when:
* - You have an expensive calculation (loops, reduce, filter on large arrays)
* - The result is derived from props or state
* - The calculation should not re-run on every re-render
*