import React, { Component } from 'react'

class WrappedIframe extends React.Component {
  state = {
    pdbLink: '',
  }
  // shouldComponentUpdate (nextProps, prevState) {
  //   console.log(111111)
  //   console.log(nextProps.pdbLink,)
  //   console.log(prevState,)
  //   if (nextProps.pdbLink == prevState.pdbLink) {
  //     return false
  //   }
  //   return true
  // }
  constructor(props) {
    super(props)
  }

  render () {
    const {
      pdbLink

    } = this.state
    return (
      <iframe
        height={'100%'}
        width={'100%'}
        name="iframe-video"
        src={pdbLink}
      />
    )
  }
  componentWillReceiveProps (nextProps, prevState) {
    // console.log(11111)
    // console.log(nextProps)
    console.log(this.state.pdbLink)
    setTimeout(() => {
      this.setState({
        pdbLink: nextProps.pdbLink

      })
    }, 10)

  }
}
export default WrappedIframe
