Last active
November 11, 2018 12:38
-
-
Save ryanflorence/bded2eadf8094704d0ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}); | |
| } | |
| } |
const is too long to type, I use let and it makes me feel a little bit I code in ML
Also, why no JSX?
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
varis so es5 :-pI've started using
constfor everything, unless I need a variable variable, and then there'slet. It's only really useful when you do have some variable variables in your code, but it doesn't hurt either way.