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

Consider moving away from `ReactDOM.unstable_renderSubtreeIntoContainer`?

Open krazi3 opened this issue 8 years ago • 2 comments

This is more of a suggestion than an issue.

I was trying to use the OverlayTrigger component and found that my mouseover and mouseout events did not bubble properly. By looking at the code i discovered that the overlays were added to the dom through the unstable render function. Although i found this approach quite interesting but the event bubbling was an issue for me ... i have solved this issue by making my own CustomOverlayTrigger component and removed the unstable render stuff and added the overlays to the dom like normal jsx elements. I was wondering that if we could get rid of unstable renders to solve some issues like events bubbling or is this the decided way? Btw the popover components perfectly mimics the functionality of the popover in the Bootstrap v3 library.

Thanks

krazi3 avatar Dec 26 '17 07:12 krazi3

If you use react v16 it will use the newer createPortal api, which will have events buble through as if they were actually sub elements, prior versions tho really have top use renderSubtreeIntoContainer though

jquense avatar Dec 26 '17 18:12 jquense

@jquense can you point out where <OverlayTrigger> uses the ReactDOM.createPortal() API? I don't see that anywhere in the source code, and I'm having some issues that I've traced to <OverlayTrigger>'s use of ReactDOM.unstable_renderSubtreeIntoContainer.

@krazi3, thanks for the suggestion around making <CustomOverlayTrigger>. I might just need to do that.

jkjustjoshing avatar Jan 18 '19 19:01 jkjustjoshing