import { useHistory, useLocation } from 'react-router-dom';
export const useUpdateSearchParams = () => {
    const history = useHistory();
    const location = useLocation();
    const updateSearchParams = (params) => {
        const searchParams = new URLSearchParams(location.search);
        Object.keys(params).forEach((key) => {
            if (params[key] !== null) {
                searchParams.set(key, params[key]);
            }
            else {
                searchParams.delete(key);
            }
        });
        history.push({
            pathname: location.pathname,
            search: searchParams.toString()
        });
    };
    return updateSearchParams;
};
//# sourceMappingURL=useUpdateSearchParams.js.map