type Props<T, C = T> = {
    onCreate: (element: C) => void;
    onChange: (element: T) => void;
    onDelete: (element: T) => void;
};

export function useCRUD<T, C = T>(props: Props<T, C>) {
    const onCreate = (element: C) => {
        props.onCreate(element);
    };
    const onChange = (element: T) => {
        props.onChange(element);
    };
    const onDelete = (element: T) => {
        props.onDelete(element);
    };

    return { onCreate, onChange, onDelete };
}
