npm.io
0.0.2 • Published 4 years ago

@hmans/use-rerender

Licence
MIT
Version
0.0.2
Deps
1
Size
8 kB
Vulns
0
Weekly
0

@hmans/use-rerender

Summary

useRerender returns a function that, when called, will cause the component to re-render, no questions asked.

import { useRerender } from "@hmans/use-rerender"

const MyComponent = () => {
  const rerender = useRerender()

  useEffect(() => {
    console.log("This component was rendered!")
  })

  return (
    <div>
      <button onClick={rerender}>Bump</button>
    </div>
  )
}