react-use-caret-position
react-use-caret-position copied to clipboard
Consumer should pass in the `ref`
We currently create the ref inside the hook and expose it to the consumer.
This works fine but also isn't very flexible. If the consumer wants to use another ref on the same element, they would have to merge the ref from our hook + the other one when attaching it to the element.
We should instead have the consumer pass the React.RefObject<HTMLInputElement | HTMLTextAreaElement> into the hook.
This would be a breaking change so we'd need to create a v2.0.0 release.
Hey @melanieseltzer, would love to contribute to this.
Will you please assign this to me ?
It's all yours, @logicalahara 😄 Thanks for the help!
For reference/a starting point, my original implementation when initially developing this hook (way back before releasing v1.0.0) had the ref getting passed in.