()
| 17 | } |
| 18 | |
| 19 | render() { |
| 20 | if (!canUseDOM) { |
| 21 | return null; |
| 22 | } |
| 23 | |
| 24 | if (!this.props.node && !this.defaultNode) { |
| 25 | this.defaultNode = document.createElement('div'); |
| 26 | document.body.appendChild(this.defaultNode); |
| 27 | } |
| 28 | |
| 29 | return ReactDOM.createPortal( |
| 30 | this.props.children, |
| 31 | this.props.node || this.defaultNode, |
| 32 | ); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | Portal.propTypes = propTypes; |
nothing calls this directly
no outgoing calls
no test coverage detected