react-hooks-force-update
v0.0.1
Published
Tiny hook to support forceUpdate() behaviour.
Downloads
17
Maintainers
Readme
Tiny hook to support forceUpdate() behaviour.
Install
yarn add react-hooks-force-update
or
npm i -S react-hooks-force-update
Usage
import useForceUpdate from 'react-hooks-force-update'
import {useEffect} from "react";
function App() {
const [value, forceUpdate] = useForceUpdate()
console.log('App render')
useEffect(() => {
console.log('useEffect is updated')
}, [value])
useEffect(() => {
const interval = setInterval(() => forceUpdate(), 1000)
return () => clearInterval(interval)
})
}