Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Last active November 11, 2018 12:38
Show Gist options
  • Save ryanflorence/bded2eadf8094704d0ab to your computer and use it in GitHub Desktop.
Save ryanflorence/bded2eadf8094704d0ab to your computer and use it in GitHub Desktop.
import React from 'react';
import md5 from 'MD5';
class Avatar extends React.Component {
static propTypes = {
email: React.PropTypes.string,
size: React.PropTypes.number
}
static defaultProps = {
size: 32
}
render () {
var { email, size } = this.props;
var hash = md5(email);
var src = `http://gravatar.com/avatar/${hash}?s=${size*2}`;
return React.DOM.img({src, size: height});
}
}
@brigand
Copy link

brigand commented Apr 3, 2015

var is so es5 :-p

I've started using const for everything, unless I need a variable variable, and then there's let. It's only really useful when you do have some variable variables in your code, but it doesn't hurt either way.

@andreypopp
Copy link

const is too long to type, I use let and it makes me feel a little bit I code in ML

@andreypopp
Copy link

Also, why no JSX?

@steelbrain
Copy link

Is it just me or size: height}); needs to be height: size});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment