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)
}}
if you want to get the key value in onKeyUp you should use e.key