Skip to content

Instantly share code, notes, and snippets.

@felipeleusin
Forked from thebuilder/Button-arrow-func.jsx
Created April 5, 2016 02:44
Show Gist options
  • Save felipeleusin/770402e6bade7388a659c20bd91cbdfb to your computer and use it in GitHub Desktop.
Save felipeleusin/770402e6bade7388a659c20bd91cbdfb to your computer and use it in GitHub Desktop.
Stateless Button with arrow binding - But this creates a new instance on every render?
import React from 'react';
function handleClick(label) {
alert('clicked ' + label);
}
function Button({label}) {
return (
<button onClick={(event) => handleClick(label)}>{label}</button>
);
}
export default Button;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment