Skip to content

Instantly share code, notes, and snippets.

@filipef101
Created March 6, 2023 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipef101/c201a4ccb56e84822975fc6bd36b9de8 to your computer and use it in GitHub Desktop.
Save filipef101/c201a4ccb56e84822975fc6bd36b9de8 to your computer and use it in GitHub Desktop.
const useConstructor(callBack) => {
const [hasBeenCalled, setHasBeenCalled] = useState(false);
if (hasBeenCalled) return;
callBack?.();
setHasBeenCalled(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment