Skip to content

Instantly share code, notes, and snippets.

@MarekZeman91
Created April 18, 2022 00:06
Show Gist options
  • Save MarekZeman91/3943d5e78d360af24961883545194768 to your computer and use it in GitHub Desktop.
Save MarekZeman91/3943d5e78d360af24961883545194768 to your computer and use it in GitHub Desktop.
import { EffectCallback, useEffect } from 'react';
export const useOnComponentMount = (onMountFn: EffectCallback) => {
useEffect(() => onMountFn(), []);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment