Retrieves the window
where the Component was mounted to.
Argument | Type | Description |
---|---|---|
Component |
React.Component |
The React component. |
Window
: The target window.
import React from 'react'
import getWindowFromComponent from '@helpscout/react-utils/dist/getWindowFromComponent'
class Napoleon extends React.Component {
...
componentDidMount () {
this.win = getWindowFromComponent(this)
// window
}
...
}