This page outlines common cases where developers use useEffect
unnecessarily, and suggests simpler, cleaner alternatives that lead to better performance and more maintainable code.
- Issue: Using
useEffect
to transform data like filtering or mapping before rendering. - Better Approach: Do the transformation directly during render.
- Example: Filter a list inside the render logic instead of setting up separate state and effects.