mirror of
https://github.com/streamich/react-use.git
synced 2025-12-08 18:02:14 +00:00
22 lines
335 B
Markdown
22 lines
335 B
Markdown
# `useUpdate`
|
|
|
|
React utility hook that returns a function that forces component
|
|
to re-render when called.
|
|
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
import {useUpdate} from 'react-use';
|
|
|
|
const Demo = () => {
|
|
const update = useUpdate();
|
|
return (
|
|
<>
|
|
<div>Time: {Date.now()}</div>
|
|
<button onClick={update}>Update</button>
|
|
</>
|
|
);
|
|
};
|
|
```
|