imaskjs
imaskjs copied to clipboard
Bug in react-imask README file
Describe the bug
There is a bug in imask-react example.
https://github.com/uNmAnNeR/imaskjs/tree/master/packages/react-imask
How is this line supposed to work?
inputRef={el => this.input = el}
There is no this
in functional components in React.
To Reproduce Not applicable. This is a bug in docs.
Expected behavior Example should present working code.
Environment: Not applicable.
@Mikilll94 For anyone that are confused. The inputRef
doesn't accept the useRef
variable as props (idk why). It is a function that contain the input ref as parameter.
Here is the working code:
const inputRef = useRef(null)
...
<IMaskInput
inputRef={el => {
inputRef.current = el
}}
/>
...
fixed