imaskjs icon indicating copy to clipboard operation
imaskjs copied to clipboard

Bug in react-imask README file

Open Mikilll94 opened this issue 2 years ago • 1 comments

Describe the bug

There is a bug in imask-react example.

Screenshot 2022-06-10 at 13 05 55 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 avatar Jun 10 '22 11:06 Mikilll94

@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
  }}
/>
...

aibrahim3546 avatar Jul 18 '22 03:07 aibrahim3546

fixed

uNmAnNeR avatar Sep 14 '22 10:09 uNmAnNeR