Skip to content

Commit cabb7fc

Browse files
author
ugogo
committed
better items ref array fill
1 parent 1d0d9a4 commit cabb7fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export default ({ length = 4, placeholder = '·' }) => {
1818

1919
const codeInputRef = React.createRef<HTMLInputElement>();
2020
const itemsRef = React.useMemo(
21-
() => [...new Array(length)].map(() => React.createRef<HTMLDivElement>()),
21+
() =>
22+
new Array(length).fill(null).map(() => React.createRef<HTMLDivElement>()),
2223
[length]
2324
);
2425

0 commit comments

Comments
 (0)