Skip to content

Instantly share code, notes, and snippets.

@tommmyy
Last active April 4, 2019 08:45
Show Gist options
  • Save tommmyy/ccb7ba73572d5421cf9380f3b3ae52a7 to your computer and use it in GitHub Desktop.
Save tommmyy/ccb7ba73572d5421cf9380f3b3ae52a7 to your computer and use it in GitHub Desktop.
const Example = ({ onClick }) => {
const memoizedHandleClick = useCallback(
(event) => onClick(event),
[] // ugly magic of hooks
);
return <Button onClick={memoizedHandleClick}>Click</Button>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment