Skip to main content

useSetResponseStale

Description#

Set service to stale once rendered.
This way it will refetch it when unmounting and remounting it again.

Usage#

import { useRecoilValue } from 'recoil';import { useSetResponseStale } from '@springtree/eva-suite-react-hooks';import { serviceState } from 'src/store/example-service';
const Example = () => {  const serviceResponse = useRecoilValue(serviceState.response);
  useSetResponseStale(serviceState.stale);
  return (/* display service response... */);};
export default Example;

References#