Skip to content

Files

Latest commit

c00f308 Β· Oct 29, 2018

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>
    </>
  );
};