import { useState } from 'react';
import { useRafCallback } from '../useRafCallback/index.js';
import { useUnmountEffect } from '../useUnmountEffect/index.js';
export function useRafState(initialState) {
    const [state, innerSetState] = useState(initialState);
    const [setState, cancelRaf] = useRafCallback(innerSetState);
    useUnmountEffect(cancelRaf);
    return [state, setState];
}
