@@ -198,39 +198,6 @@ memo(ReportActionItem, (prevProps, nextProps) =>
198198)
199199```
200200
201- ---
202-
203- ### [ PERF-6] Use specific properties as hook dependencies
204-
205- - ** Search patterns** : ` useEffect ` , ` useMemo ` , ` useCallback ` dependency arrays
206-
207- - ** Condition** : In ` useEffect ` , ` useMemo ` , and ` useCallback ` , specify individual object properties as dependencies instead of passing entire objects.
208- - ** Reasoning** : Passing entire objects as dependencies causes hooks to re-execute whenever any property changes, even unrelated ones. Specifying individual properties creates more granular dependency tracking, reducing unnecessary hook executions and improving performance predictability.
209-
210- Good:
211-
212- ``` tsx
213- const {amountColumnSize, dateColumnSize, taxAmountColumnSize} = useMemo (() => {
214- return {
215- amountColumnSize: transactionItem .isAmountColumnWide ? CONST .SEARCH .TABLE_COLUMN_SIZES .WIDE : CONST .SEARCH .TABLE_COLUMN_SIZES .NORMAL ,
216- taxAmountColumnSize: transactionItem .isTaxAmountColumnWide ? CONST .SEARCH .TABLE_COLUMN_SIZES .WIDE : CONST .SEARCH .TABLE_COLUMN_SIZES .NORMAL ,
217- dateColumnSize: transactionItem .shouldShowYear ? CONST .SEARCH .TABLE_COLUMN_SIZES .WIDE : CONST .SEARCH .TABLE_COLUMN_SIZES .NORMAL ,
218- };
219- }, [transactionItem .isAmountColumnWide , transactionItem .isTaxAmountColumnWide , transactionItem .shouldShowYear ]);
220- ```
221-
222- Bad:
223-
224- ``` tsx
225- const {amountColumnSize, dateColumnSize, taxAmountColumnSize} = useMemo (() => {
226- return {
227- amountColumnSize: transactionItem .isAmountColumnWide ? CONST .SEARCH .TABLE_COLUMN_SIZES .WIDE : CONST .SEARCH .TABLE_COLUMN_SIZES .NORMAL ,
228- taxAmountColumnSize: transactionItem .isTaxAmountColumnWide ? CONST .SEARCH .TABLE_COLUMN_SIZES .WIDE : CONST .SEARCH .TABLE_COLUMN_SIZES .NORMAL ,
229- dateColumnSize: transactionItem .shouldShowYear ? CONST .SEARCH .TABLE_COLUMN_SIZES .WIDE : CONST .SEARCH .TABLE_COLUMN_SIZES .NORMAL ,
230- };
231- }, [transactionItem ]);
232- ```
233-
234201## Instructions
235202
2362031 . ** First, get the list of changed files and their diffs:**
0 commit comments