Skip to content

Commit 4192a3e

Browse files
committed
refactored all spread array constructors to Array.from
1 parent 13a6c5b commit 4192a3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/use-dropdown-menu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function useDropdownMenu(itemCount: number): DropdownMenuResponse
3636

3737
// Initialize refs and update them when the item count changes
3838
useEffect(() => {
39-
itemRefs.current = [...Array<undefined>(itemCount)].map(() => createRef<HTMLAnchorElement>());
39+
itemRefs.current = Array.from({ length: itemCount }, () => createRef<HTMLAnchorElement>());
4040
}, [itemCount]);
4141

4242
// Create type guard
@@ -199,7 +199,7 @@ export default function useDropdownMenu(itemCount: number): DropdownMenuResponse
199199
'aria-expanded': isOpen,
200200
};
201201

202-
const itemProps = [...Array<undefined>(itemCount)].map((_ignore, index) => ({
202+
const itemProps = Array.from({ length: itemCount }, (_ignore, index) => ({
203203
onKeyDown: itemListener,
204204
tabIndex: -1,
205205
role: 'menuitem',

0 commit comments

Comments
 (0)