0.0.1 • Published 1 year ago
react-hooks-force-update v0.0.1
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)
})
}
0.0.1
1 year ago