react-popover icon indicating copy to clipboard operation
react-popover copied to clipboard

Sandbox Example Please

Open m-o-leary opened this issue 6 years ago • 2 comments

Could you please put an example in the readme of how to get this running from scratch?

it's very confusing to have to backtrack through all the story code to try and get a basic popover up and running.

The reason I ask is I am getting _reactDom2.default.createPortal is not a function error and I have no idea why but I'm sure it's my understanding of how to get setup.

Thanks

m-o-leary avatar Mar 17 '18 06:03 m-o-leary

I'm getting this error as well. Component:

import * as React from 'react';
import Popover  from 'react-popover'

class ReportTile extends React.Component<{ name: string }, { isOpen: boolean }> {
  constructor(props) {
    super(props);

    this.state = {
      isOpen: false
    }
  }

  togglePopover = () => {
    this.setState({ isOpen: !this.state.isOpen })
  }

  render() {
    return (
      <div>   
        <Popover 
          body={
            <p>test3</p>
          }
          isOpen={this.state.isOpen} 
          onOuterAction={this.togglePopover}
        >
          <div onClick={this.togglePopover} className='report-tile'>
            <h5 className='report-name'>{this.props.name}</h5>
          </div>
        </Popover>
      </div>  
    )
  }
}

export default ReportTile;

ericettensohn avatar Mar 25 '18 13:03 ericettensohn

createPortal was introduced in React 16. You might be running 15 or lower.

jake-nz avatar Apr 12 '18 22:04 jake-nz