Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 498 Bytes

File metadata and controls

24 lines (18 loc) · 498 Bytes

react-native-app-helpers/useRefresh

A React hook which returns a function which can be invoked to force a refresh of the Component.

Usage

import { useRefresh } from "react-native-app-helpers";

const ExampleScreen = () => {
  const invocations = React.useRef(-1);
  invocations.current++;

  const refresh = useRefresh();

  return (
    <Button
      onPress={refresh}
      title={`Refreshed ${invocations.current} time(s).  Click or touch to refresh again.`}
    />
  );
};