@kofile/react-child-window
v0.3.0
Published
A React component for opening and managing child browser windows
Downloads
20
Maintainers
Readme
React Child Window
Usage
import { ChildWindow } from '@kofile/react-child-window'
const App = () => (
<div>
<Content>
<ChildWindow
onLoad={(childComp, childWindow) => { /* ... */ }}
onUnload={(childComp, childWindow) => { /* ... */ }}
options={[
'url',
'title',
...attributes
]}
mountId='childCSSID'
open={true}
setRef={el => { /* ... */ }}
>
<User name='default' age='props' />
</ChildWindow>
</div>
)
Props
onLoad
:Function
(childComp, childWindow) => void
- What to do when the child
window
loads - Similar to
onComponentDidMount
onUnload
:Function
(childComp, childWindow) => void
- What to do right before the child
window
unmounts/closes - Similar to
componentWillUnmount
options
:Array<String>
[url, title, 'toolbar=false', 'menu=false']
url
andtitle
are normal strings with the rest of the array are window features
mountId
:String
'mount'
- The
#id
of the element to treat as thedomEl
inside ofReactDOM.render(ReactEl, domEl)
open
:Boolean
false
- If this child window is open or not