import { useState, useCallback } from 'react';

const useFormState = ({ remoteState })=>{
    const [localState, setLocalState] = useState(remoteState);
    const resetLocalState = useCallback(()=>{
        setLocalState(remoteState);
    }, [
        remoteState
    ]);
    const [editing, setEditing] = useState(false);
    const handleSetEditing = useCallback((newEditing)=>{
        if (newEditing) {
            resetLocalState();
        }
        setEditing(newEditing);
    }, [
        resetLocalState
    ]);
    return {
        localState,
        setLocalState,
        editing,
        handleSetEditing
    };
};

export { useFormState };
//# sourceMappingURL=useFormState.mjs.map
