Skip to content

Instantly share code, notes, and snippets.

@ahtcx
Created May 10, 2020 12:27
Show Gist options
  • Save ahtcx/7205692d3842ebee9175e1274d4c7b50 to your computer and use it in GitHub Desktop.
Save ahtcx/7205692d3842ebee9175e1274d4c7b50 to your computer and use it in GitHub Desktop.
import { useCallback, useState } from "react";
export const useForceUpdate = () => {
const [, dispatch] = useState(Object.create(null));
return useCallback(() => dispatch(Object.create(null)), [dispatch]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment