BitMEX
BitMEX
Jan 23, 2018 · 1 min read

I’ve figured this out: render null until you mount, then on componentDidMount, create the target div, inject it in the new window, then setState({mounted: true}). Then in render(), render to the portal when mounted. This appears to set up the event proxies correctly. I was having serious trouble with key events (but oddly, not click events) until I refactored this way.

I’ll push a PR to https://github.com/rmariuzzo/react-new-window/ to illustrate.

BitMEX

Written by

BitMEX

Based in Seychelles, offers next generation crypto-coin trading platform, which supports highly leveraged trading via perpetual and fixed-date contracts.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade