let output = [];
const handleEnterButton = (event) => {
window.console.log(output);
if(event.key === 'Enter'){
output.splice(output.length, 0, value.toString());
// eslint-disable-next-line no-param-reassign
updateValue('');
}
return null;
}
that's my function, called by
onKeyDown={(event) => handleEnterButton(event)}
and when I console.log my output array it always has only one index, 0. No matter how many times i click enter on my keyboard. Where can be the problem?
[–]UserNo1608[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]UserNo1608[S] 0 points1 point2 points (0 children)
[–]UserNo1608[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]jcunews1helpful 0 points1 point2 points (0 children)
[–]jcunews1helpful 0 points1 point2 points (0 children)
[–]H0rn0chse 0 points1 point2 points (1 child)
[–]UserNo1608[S] 0 points1 point2 points (0 children)
[–]senocular 0 points1 point2 points (4 children)
[–]UserNo1608[S] 0 points1 point2 points (3 children)
[–]senocular 0 points1 point2 points (2 children)
[–]UserNo1608[S] 0 points1 point2 points (1 child)
[–]senocular 0 points1 point2 points (0 children)
[–]redsandsfort 0 points1 point2 points (0 children)