import React from "react";
import { TextareaControlled } from "../Textarea";

const ParentComponent = props => {
  let [myText, setText] = React.useState('');
  return /*#__PURE__*/React.createElement("div", null, props.component({
    myText,
    setText
  }), /*#__PURE__*/React.createElement("button", {
    onClick: () => {
      setText('Set Controlled value via button');
    }
  }, "Set Controlled "));
};

export function TextareaControlledExample() {
  return /*#__PURE__*/React.createElement(ParentComponent, {
    component: _ref => {
      let {
        myText
      } = _ref;
      return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TextareaControlled, {
        defaultValue: myText,
        placeholder: "set controlled defaultvalue set via button"
      }), " ");
    }
  });
}