buildo/react-autosize-textarea

`innerRef` shortcomings

Closed this issue · 1 comments

In addition to #102, the way that ref is handled presently is incorrect.

innerRef should be of type (element: HTMLTextAreaElement | null) => void in line with React API. This code here ignores updates when the element is unmounted (e.g. when the ref is null), causing client code to keep cached references to unmounted elements.

Solution is to remove saveDOMNodeRef entirely and to pass innerRef directly to ref on the textarea component. This would also satisfy #102.

Fixed in #124 with removal of innerRef.