Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 335 Bytes

useUpdate.md

File metadata and controls

21 lines (16 loc) · 335 Bytes

useUpdate

React utility hook that returns a function that forces component to re-render when called.

Usage

import {useUpdate} from 'react-use';

const Demo = () => {
  const update = useUpdate();
  return (
    <>
      <div>Time: {Date.now()}</div>
      <button onClick={update}>Update</button>
    </>
  );
};