You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### [PERF-5] Avoid inline object/array/function creation in JSX
106
-
-**Condition**: Objects, arrays, and functions should not be created inline in JSX. Use `useMemo` or `useCallback` to memoize them when there's actual performance benefit.
107
-
-**Reasoning**: Inline creation generates new instances on every render, breaking React's reconciliation optimizations and forcing child component re-renders. Memoization moves the creation cost outside the render cycle and enables proper optimization.
### [PERF-6] Use shallow comparisons instead of deep comparisons
105
+
### [PERF-5] Use shallow comparisons instead of deep comparisons
135
106
-**Condition**: In `React.memo` and similar optimization functions, compare only specific relevant properties instead of using deep equality checks.
136
107
-**Reasoning**: Deep equality checks recursively compare all nested properties, creating performance overhead that often exceeds the re-render cost they aim to prevent. Shallow comparisons of specific relevant properties provide the same optimization benefits with minimal computational cost.
0 commit comments