UNPKG

monday-ui-react-core

Version:

Official monday.com UI resources for application development in React.js

12 lines (8 loc) 394 B
import { useReducer } from "react"; // the second arguemnt of useReducer is the dispatch function // after calling dispatch we will set a new object in the state // if the state will change by reference it will force rerender of the component const reducerAlwaysReturningNewObj = () => ({}); export default function useForceUpdate() { return useReducer(reducerAlwaysReturningNewObj)[1]; }