react-hooks-force-update
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Tiny hook to support forceUpdate() behaviour.

npm

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)
  })
}

Package Sidebar

Install

npm i react-hooks-force-update

Weekly Downloads

4

Version

0.0.1

License

MIT

Unpacked Size

2.56 kB

Total Files

6

Last publish

Collaborators

  • zvs001