Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Expose hook version to use with other libraries #331

Open
adambrgmn opened this issue Jun 9, 2021 · 0 comments
Open

Proposal: Expose hook version to use with other libraries #331

adambrgmn opened this issue Jun 9, 2021 · 0 comments

Comments

@adambrgmn
Copy link

Hey! Thanks for this awesome library 馃檹 I've been using it in different projects with success 馃憦
In a recent project I was using react-mde as a markdown editor. It uses a <textarea> under the hood. But I wanted it to auto-expand. I tried some different css solutions without any luck.

Then I thought, maybe it would be possible to expose the logic in this library as a hook. I gave it a go, and it works like a charm!

I created an api like this:

const textareaRef = useRef<HTMLTextareaElement>(null);
useTextareaAutosize(textareaRef, { minRows: 8 });

return <ReactMDE {...} refs={{ textarea: textareaRef }} />;

I totally agree if you think this is out of scope of this project. But if you like the idea I would love to give it a go and provide a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant