From f0d3b73da3b559ab31326cd87541112750fb734e Mon Sep 17 00:00:00 2001 From: Egemen Uzunali Date: Wed, 3 Mar 2021 14:56:42 +0100 Subject: [PATCH] Fill the new array so your example works Hi man, great example I believe you forgot to fill the array. This should fix your example. --- App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/App.tsx b/App.tsx index 84303a33..40616e35 100644 --- a/App.tsx +++ b/App.tsx @@ -14,7 +14,7 @@ const CodeInput = () => { const [code, setCode] = useState(''); const [containerIsFocused, setContainerIsFocused] = useState(false); - const codeDigitsArray = new Array(CODE_LENGTH); + const codeDigitsArray = new Array(CODE_LENGTH).fill(0); const ref = useRef(null);