import React from 'react'
import PropTypes from 'prop-types'

const uncontrollable = Component => {
  class UncontrollableComponent extends React.Component {
    static propTypes = {
      value: PropTypes.any,
      defaultValue: PropTypes.any,
      onChange: PropTypes.func,
    }

    state = {
      value: null,
    }

    isControlled() {
      return this.props.value !== undefined
    }

    handleChange = value => {
      if (this.isControlled()) {
        if (this.props.onChange) {
          this.props.onChange(value)
        }
      } else {
        this.setState({ value })
      }
    }

    render() {
      return (
        <Component
          {...this.props}
          value={this.isControlled() ? this.props.value : this.state.value}
          onChange={this.handleChange}
        />
      )
    }
  }

  return UncontrollableComponent
}

export default uncontrollable

@@ -309,60 +309,283 @@
 ue: 
-null,%0A    %7D%0A%0A    isControlled() %7B%0A      return this.
+this.isControlled() ? this.props.value : null,%0A    %7D%0A%0A    componentWillReceiveProps(nextProps) %7B%0A      if (this.isControlled(nextProps)) %7B%0A        this.setState(%7B%0A          value: nextProps.value,%0A        %7D)%0A      %7D%0A    %7D%0A%0A    isControlled(props = this.props) %7B%0A      return 
 prop

fix uncontrollable