2.3.0 • Published 4 years ago

react-custom-hook-use-force-update v2.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

npm version

Live example

React hook to call force render.

This project was created to help people use force render in functional components

Usage

import React from "react";
import { useForceUpdate } from "react-custom-hook-use-force-update";

const App = () => {
  // If you use eslint plugin rules-of-hooks,
  // first letter must be capitalized according to the rule: react-hooks/rules-of-hooks
  const UseForceUpdateFn = useForceUpdate();

  function handleClick() {
    UseForceUpdateFn();
  }

  return (
    <button onClick={handleClick}>Do it</button>
  );
};

export default App;