Skip to content

Instantly share code, notes, and snippets.

@thebuilder
Last active April 5, 2016 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thebuilder/2c23b40a0bb5695e8c4a94b6652935ed to your computer and use it in GitHub Desktop.
Save thebuilder/2c23b40a0bb5695e8c4a94b6652935ed 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