reactjs - React - on outside click of component subtree -


i'm aware of several solutions detecting 'outside' clicks react component - i.e. use dom elements' .contains method see if event originated within dom tree - however, know of can detect such events 'outside' of actual component hierarchy? example, work portals above method not (since dom tree isn't representative of react tree).

edit: example:

<div>   <div onoutsideclick={handleoutsideclick}> // onoutsideclick implementation todo     <div>       <button /> // same dom tree, same component tree, detected not outside (ding)     </div>     <div>       <portal>         <button /> // not same dom tree, same component tree, detected outside (bzzt)       </portal>     </div>   </div>   <button /> // not same component tree, nor dom tree, detected outside (ding) </div> 


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -