chore: code optimization (#47454)

This commit is contained in:
lijianan 2024-02-17 19:56:41 +08:00 committed by GitHub
parent a84af71d14
commit be67895a93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,12 +172,12 @@ const Row = React.forwardRef<HTMLDivElement, RowProps>((props, ref) => {
rowStyle.marginRight = horizontalGutter;
}
[, rowStyle.rowGap] = gutters;
// "gutters" is a new array in each rendering phase, it'll make 'React.useMemo' effectless.
// So we deconstruct "gutters" variable here.
const [gutterH, gutterV] = gutters;
rowStyle.rowGap = gutterV;
const rowContext = React.useMemo<RowContextState>(
() => ({ gutter: [gutterH, gutterV] as [number, number], wrap }),
[gutterH, gutterV, wrap],