Skip to content

Instantly share code, notes, and snippets.

@amanda-mitchell
Last active February 10, 2019 23:56
Show Gist options
  • Select an option

  • Save amanda-mitchell/6ee451a559c57246259a3c96ee549370 to your computer and use it in GitHub Desktop.

Select an option

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