'React set target value on onKeyUp

I can set the target value by using e.target.value on onBlur function, if we change onBlur to onKeyUp, there will be an error shown below:

Property 'value' does not exist on type 'EventTarget'.

Since I am using React hook form, so I would like to solve this without using extra useState

  onBlur={(e) => {
    e.target.value = formatFunc(e.target.value)
  }}
  onKeyUp={(e) => {
    e.target.value = formatFunc(e.target.value)
  }}


Solution 1:[1]

if you want to get the key value in onKeyUp you should use e.key

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ????