I'm trying a simple use-case where a value of an input type number should change using a mouse scroll. It is working when I used useState hook to the input. Value is not updating, instead, the page is scrolling. Don't know what is missing.
Please see the example block of code
import React from 'react'
const NumberField = () =>{
const [inputValue, setInputValue] = useState()
const handleInputChange = (event:React.ChangeEvent<HTMLInputElement>)=>{
const value = event.target.value
setInputValue(value)
}
return(
<input type="number" value={inputValue} onChange={handleInputChange}>
)
}
Can anyone please provide a solution to update the value on scroll and at the same time page should not scroll when the value is updating in the input field. Thanks.