Skip to content

Instantly share code, notes, and snippets.

@MarekZeman91
Created April 18, 2022 00:00
Show Gist options
  • Save MarekZeman91/106e408d922ee47c107ca98aa95109b1 to your computer and use it in GitHub Desktop.
Save MarekZeman91/106e408d922ee47c107ca98aa95109b1 to your computer and use it in GitHub Desktop.
import { useMemo } from 'react';
export const useConst = <T>(initialStateGetter: () => T) => {
return useMemo(initialStateGetter, []);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment