import React, { FormEvent, InputHTMLAttributes } from 'react' interface NumberInputProps extends InputHTMLAttributes { value: string onValue?: (val: string) => void } const NumberInput = React.forwardRef( (props: NumberInputProps, forwardedRef) => { const { value, onValue, ...itemProps } = props const handleOnInput = (evt: FormEvent) => { const target = evt.target as HTMLInputElement const val = target.value.replace(/\D/g, '') onValue?.(val) } return ( ) } ) export default NumberInput