Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 339 Bytes

useUpdate.md

File metadata and controls

20 lines (15 loc) · 339 Bytes

useUpdate

React实用程序钩子,它返回一个强制组件在被调用时重新呈现的函数。

用法

import {useUpdate} from 'react-use';

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