Last active
April 12, 2020 13:17
-
-
Save HaNdTriX/093129d6298ca41298513229e1bbf44a to your computer and use it in GitHub Desktop.
Force update hook for react.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react' | |
const useForceUpdate = () => { | |
const [, setState] = useState() | |
return setState | |
} | |
export default useForceUpdate |
I used this code to create a canvas renderer, that rerenders every 16ms.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage