docs: function useField(name) {
    var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
    if (!React__default.useState) {
      throw new Error("Hooks api need react@>=16.8, Please upgrade your reactjs.");
    }
  
    var useState = React__default.useState,
        useLayoutEffect = React__default.useLayoutEffect,
        useRef = React__default.useRef;
    var $name;
  
    if (name) {
      if (typeof name === 'string') {
        $name = name;
        props.name = $name;
      } else {
        props = name;
        $name = props.name;
      }
    }
  
    var $formContext = useFormContext();
    /** @type {any} */
  
    var $this = useRef({}).current;
    /** @type {React.MutableRefObject<any[]>} */
  
    var callbackRef = useRef([]);
    var $registered;
    $this.$formContext = $formContext;
    $this.props = props;
    $this.$setState = $setState; // we not directly use this $state, just from $this.$state
  
    var _useState = useState(function () {
      $this.$$FIELD_UUID = GET_FIELD_UUID();
      $this.$fieldHandler = $registered = createHandler($this);
      var $state = $this.$fieldHandler.$$reset();
      $this.$fieldHandler.$validate();
      return $state;
    }),
        _useState2 = _slicedToArray(_useState, 2),
        setState = _useState2[1];
  
    if (!$registered) {
      $registered = ($formContext.$$registers || {})[$this.$fieldHandler.$name] || $this.$fieldHandler;
    }
  
    useLayoutEffect(function () {
      var $state = $this.$state;
  
      if ($this.isMounting) {
        if (!($name in ($formContext.$$registers || {}))) {
          var $prevValue = $this.$prevValue;
          $registered.$$triggerChange({
            $newValue: $state.$value,
            $prevValue: $prevValue
          });
        }
      }
  
      $this.$prevValue = $state.$value;
    }, [$this.$state.$value]);
    useLayoutEffect(function () {
      $this.isMounting = true;
      warning(!$name || $formContext.$formutil, "You should enusre that the useField() with the name '".concat($name, "' must be used underneath a <Form /> component or withForm() HOC, otherwise it's isolated."));
      warning($name, "You should pass a name argument to useField(), otherwise it will be isolated!");
      return function () {
        if ($formContext.$$unregister) {
          $formContext.$$unregister($name, $this.$fieldHandler, props.$reserveOnUnmount);
        }
  
        $this.isMounting = false;
      };
    }, []);
    useLayoutEffect(function () {
      if ($formContext.$$register) {
        $formContext.$$register($name, $this.$fieldHandler, $this.$prevName);
      }
  
      $this.$prevName = $name;
    }, [$name]);
    useLayoutEffect(function () {
      if (callbackRef.current.length > 0) {
        var callbackQueue = _toConsumableArray(callbackRef.current);
  
        callbackRef.current.length = 0;
  
        while (callbackQueue.length) {
          callbackQueue.pop()($this.$fieldutil);
        }
      }
    });
  
    function $setState($newState, callback) {
      return new Promise(function (resolve) {
        var execute = function execute() {
          return resolve(runCallback(callback, $this.$fieldutil));
        };
  
        if ($this.isMounting) {
          if ($name in ($formContext.$$registers || {})) {
            $formContext.$$onChange($name, $newState, execute);
          } else {
            setState($registered.$$merge($newState));
            $registered.$$detectChange($newState);
            callbackRef.current.push(execute);
          }
        } else {
          $registered.$$merge($newState);
          execute();
        }
      });
    }
  
    return $this.$fieldutil = _objectSpread({
      $name: $name
    }, $registered.$getState(), $registered, {
      $$formutil: $formContext.$formutil
    });
  }