Skip to content

Instantly share code, notes, and snippets.

@mxriverlynn
Forked from ericelliott/hello-word.js
Last active August 29, 2015 14:28
Show Gist options
  • Save mxriverlynn/4a7a6c4a899279d9c80b to your computer and use it in GitHub Desktop.
Save mxriverlynn/4a7a6c4a899279d9c80b to your computer and use it in GitHub Desktop.
react component
'use strict';
let Hello = function (props) {
return {
props, // set props
render () {
// get `word` from props obj with
// es6 destructuring:
const { word } = this.props;
return (
// Fill in the { blanks }
<p>Hello, { word }!</p>
);
}
};
};
export default Hello;
<script type="text/jsx">
var word = 'puppy';
var content = document.getElementById("content");
React.render (
<Hello word={ word } />,
content
);
</script>
<div id="content"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment