JakeGinnivan / react-popout

React popout is a React component wrapping window.open allowing you to host content in a browser popup window.
MIT License
189 stars 59 forks source link

onClick() not working in popup #36

Open Shooshte opened 7 years ago

Shooshte commented 7 years ago

This is my component:

import React, {Component} from 'react'
import PopoutWindow from 'react-popout'

class Help extends Component {
  render() {
    return (
      <PopoutWindow
        onClosing={this.props.closeHelpWindow}
        options={{width: '500px', height: '500px'}}
        ref={el => this._popup = el}
        >
      <div>

      // Other HTML content

      <div onClick={console.log('click')}>CLICK</div>

      <button onClick={() => {
        console.log('CLICK')
        this.props.closeHelpWindow
        this._popup.closeWindow
      }}>
        Ok
      </button>
    </div>
    </PopoutWindow>
    )
  }
}

export default Help

When I click the DIV or the button, nothing gets logged to the console (i used inspect on the popup window).