From bfe3945ee6037e6777bd1b3cdb7528fdaef9f11b Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Fri, 26 Apr 2024 13:30:02 +0200 Subject: [PATCH] Avoid spread in accumulators --- packages/react-date-picker/src/DateInput.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-date-picker/src/DateInput.tsx b/packages/react-date-picker/src/DateInput.tsx index 783e9541..c37cdaf7 100644 --- a/packages/react-date-picker/src/DateInput.tsx +++ b/packages/react-date-picker/src/DateInput.tsx @@ -146,7 +146,7 @@ function renderCustomInputs( // eslint-disable-next-line react/no-array-index-key {element} ); - const res = [...arr, divider]; + arr.push(divider); const currentMatch = matches && matches[index]; if (currentMatch) { @@ -159,18 +159,18 @@ function renderCustomInputs( ]; if (!renderFunction) { - return res; + return arr; } if (!allowMultipleInstances && usedFunctions.includes(renderFunction)) { - res.push(currentMatch); + arr.push(currentMatch); } else { - res.push(renderFunction(currentMatch, index)); + arr.push(renderFunction(currentMatch, index)); usedFunctions.push(renderFunction); } } - return res; + return arr; }, []); }