Skip to content

Commit fb45217

Browse files
committed
fix: use memo for extracted functional components
1 parent 470f28c commit fb45217

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/components/Table/SortableTable.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classnames from 'classnames';
2-
import React from 'react';
2+
import React, { memo } from 'react';
33
import { useUniqueId } from '../../util/uniqueId';
44
import Button from '../Button/Button';
55
import Icon from '../Icon/Icon';
@@ -71,7 +71,7 @@ function defaultRenderRow(
7171
];
7272
}
7373

74-
function SelectableCell({ row, rowSelected, onSelect }) {
74+
const SelectableCell = memo(({ row, rowSelected, onSelect }) => {
7575
const selectRowId = useUniqueId('select-row-', 1);
7676
return (
7777
<>
@@ -89,9 +89,9 @@ function SelectableCell({ row, rowSelected, onSelect }) {
8989
/>
9090
</>
9191
);
92-
}
92+
});
9393

94-
function SelectAllHeader({ allSelected, onSelectAll }) {
94+
const SelectAllHeader = memo(({ allSelected, onSelectAll }) => {
9595
const id = useUniqueId('select-all-', 1);
9696
return (
9797
<>
@@ -108,7 +108,7 @@ function SelectAllHeader({ allSelected, onSelectAll }) {
108108
/>
109109
</>
110110
);
111-
}
111+
});
112112

113113
function getExpandableCell(row, expanded, onExpand) {
114114
return (

0 commit comments

Comments
 (0)