Skip to content

Instantly share code, notes, and snippets.

View prdxs's full-sized avatar

Rubén Fernández-Butrón prdxs

View GitHub Profile
class ClicksButton extends Component {
constructor(props) {
super(props);
this.state = {
clicks: 0,
};
}
handleClick = () => {
this.setState(({ clicks }) => ({
clicks: clicks + 1,
function StatelessButton({ className, size, color, children }) {
const style = {
backgroundColor: color,
padding: sizeToPadding[size],
fontSize: sizeToFontSize[size],
};
return (
<button className={clsx('StatelessButton', className)} style={style}>
{children}
</button>