react-use icon indicating copy to clipboard operation
react-use copied to clipboard

Support portal hook

Open tmohammad78 opened this issue 5 years ago • 1 comments

Hey guys , I think it's good to have custom hook as usePortal , that make easier to use portal for example :

  const { Portal, show, hide, isShow, toggle } = usePortal({
    escToHide: false,
  });

and if we want use it ,

    <Portal>
      <div
        id="modal"
        onClick={handleClickBackdrop}>
        <div className="modal__body">
          <header className="modal__body-header">{children?.header}</header>
          {children.body}
        </div>
      </div>
    </Portal>

if it is a good idea i can make a PR

tmohammad78 avatar Oct 12 '21 07:10 tmohammad78

This is a good design, but I think it's unnecessary to implement a complex hook while it can be achieved by multiple simple hooks those are already exist. For example, I can do the same by combining useToggle + <Portal /> + useKeyboard without looking api docs.

iamyoki avatar Jan 07 '22 02:01 iamyoki