UNPKG

@resourge/react-fetch

Version:

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

26 lines (23 loc) 671 B
/** * react-fetch v1.41.3 * * Copyright (c) resourge. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import { useRef, useEffect } from 'react'; import NotificationService from '../services/NotificationService'; const useFetchOnDependencyUpdate = (deps, filterRequest) => { const firstRef = useRef(true); useEffect(() => { if (!firstRef.current) { NotificationService.requestAllAgain(filterRequest); } firstRef.current = false; }, deps); }; export { useFetchOnDependencyUpdate }; //# sourceMappingURL=useFetchOnDependencyUpdate.js.map