Skip to content

Instantly share code, notes, and snippets.

@alex35mil
Created October 14, 2016 13:18
Show Gist options
  • Save alex35mil/51f78e62bce7fa96131a32e0820fb039 to your computer and use it in GitHub Desktop.
Save alex35mil/51f78e62bce7fa96131a32e0820fb039 to your computer and use it in GitHub Desktop.
Get rid of focus after click
const Button = ({ onClick, ...otherProps }) => {
let domNode;
return (
<button
{...otherProps}
ref={ref => (domNode = ref)}
onClick={event => {
if (onClick) onClick(event);
domNode.blur();
}}
/>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment