react-hanger
react-hanger copied to clipboard
Add useClickAway
React hook useClickAway() that reacts to clicks outside the bound element, and calls the expression that is passed in when this event is detected.
Hey man. I'm currently on vacation I'll definitely have some inputs later (regarding naming and Typescript maybe), I'll feedback with all stuff at once to keep it clear and single change for you and not multiple back and forths :) I'll try to check it out within this week for sure. Maybe tomorrow evening or this evening.
It already exists: https://github.com/streamich/react-use/blob/master/docs/useClickAway.md
The question is, do we want to add stuff to react hanger that already exists in other hooks libraries 🤔
I think it's not that bad idea, especially if those others are not properly typed :) Or don't have typings at all :)
Although I need to do a little research. I plan to do major release soon. Removing something that I'm not sure people are using or was a good idea to add :)
So we need to add all that new stuff to it maybe and finally do something about sizzy hooks. There are a lot of them :) Type them, test them and improve if needed.
On Thu, Aug 27, 2020, 08:45 Kitze [email protected] wrote:
The question is, do we want to add stuff to react hanger that already exists in other hooks libraries 🤔
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kitze/react-hanger/pull/56#issuecomment-681712850, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6B5374S3E2NQRSORY4FITSCYFIRANCNFSM4QKVVLTQ .
Ok. As I see react-use
has this one with typescript so I think this one is pretty useless. So I would keep this one out of the react-hanger.
IMO we should ditch react-hanger
completely in favor of react-use
and just merge our hooks with theirs :P
@kitze whatdaya think? :D
@RIP21 I don't agree because all of their hooks are array based, and there might be differences in individual hooks (i.e they have different methods for useNumber
)
@geobde wouldn't it be better for this hook to create a ref inside and return it as a result of the hook? I think that'll make it more reusable.