Skip to content

Commit

Permalink
Avoid spread in accumulators
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Apr 26, 2024
1 parent 36645a1 commit bfe3945
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/react-date-picker/src/DateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function renderCustomInputs(
// eslint-disable-next-line react/no-array-index-key
<Divider key={`separator_${index}`}>{element}</Divider>
);
const res = [...arr, divider];
arr.push(divider);
const currentMatch = matches && matches[index];

if (currentMatch) {
Expand All @@ -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;
}, []);
}

Expand Down

0 comments on commit bfe3945

Please sign in to comment.