import "core-js/modules/es.array.iterator.js";
import "core-js/modules/web.dom-collections.iterator.js";
import { useRef, useEffect } from 'react';
import useMergedState from 'rc-util/es/hooks/useMergedState';
function useMountMergeState(initialState, option) {
  const mountRef = useRef(false);
  useEffect(() => {
    mountRef.current = true;
    return () => {
      mountRef.current = false;
    };
  });
  const [state, setState] = useMergedState(initialState, option);
  const mountSetState = prevState => {
    requestAnimationFrame(() => {
      if (mountRef.current) {
        setState(prevState);
      }
    });
  };
  return [state, mountSetState];
}
export default useMountMergeState;