Skip to content

Commit acc42c2

Browse files
extract new Map into a function
1 parent 526079f commit acc42c2

File tree

1 file changed

+5
-1
lines changed
  • packages/mui-material/src/Tabs

1 file changed

+5
-1
lines changed

packages/mui-material/src/Tabs/Tabs.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ const defaultIndicatorStyle = {};
285285

286286
let warnedOnceTabPresent = false;
287287

288+
function createMap() {
289+
return new Map();
290+
}
291+
288292
const Tabs = React.forwardRef(function Tabs(inProps, ref) {
289293
const props = useDefaultProps({ props: inProps, name: 'MuiTabs' });
290294
const theme = useTheme();
@@ -376,7 +380,7 @@ const Tabs = React.forwardRef(function Tabs(inProps, ref) {
376380
scrollbarWidth: 0,
377381
});
378382

379-
const valueToIndex = useLazyRef(() => new Map()).current;
383+
const valueToIndex = useLazyRef(createMap).current;
380384
const tabsRef = React.useRef(null);
381385
const tabListRef = React.useRef(null);
382386
const childIndexRef = React.useRef(0);

0 commit comments

Comments
 (0)