tajo/react-portal

[Feature Request] Optional prop to render only one child at a time

haxxxton opened this issue · 0 comments

Currently react-portal appends subsequent portal'ed content into the same element. This means that you can 'portal' multiple elements at once. However, occasionally you want to manage this such that only a single child is rendered at a time. and that triggering the render of a new child, closes any that may be open. My use case for this is hoverable tooltips; i find that sometimes the onMouseLeave event is not always fired if moving quickly, and allows the user to spawn many tooltips at once.

Suggested prop name would be something like closeOtherChildren or closeOthersOnOpen or orphanMode