Skip to content

Instantly share code, notes, and snippets.

@amanda-mitchell
Last active February 10, 2019 23:56
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 amanda-mitchell/6ee451a559c57246259a3c96ee549370 to your computer and use it in GitHub Desktop.
Save amanda-mitchell/6ee451a559c57246259a3c96ee549370 to your computer and use it in GitHub Desktop.
function useBoundEffect<TArguments extends any[]>(
effect: (...params: TArguments) => ReturnType<React.EffectCallback>,
...params: TArguments
) {
return useEffect(() => effect(...params), params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment