React Child Window
![Coverage Status](https://coveralls.io/repos/github/kofile/react-child-window/badge.svg)
![Ma Child](http://ghk.h-cdn.co/assets/15/37/1600x800/landscape-1441924989-gettyimages-158313493.jpg)
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
and title
are normal strings with the rest of the array are window features
-
mountId
:
String
'mount'
- The
#id
of the element to treat as the domEl
inside of ReactDOM.render(ReactEl, domEl)
-
open
:
Boolean
false
- If this child window is open or not