Skip to content

Instantly share code, notes, and snippets.

@peterlazar1993
Created November 20, 2015 09:08
Show Gist options
  • Save peterlazar1993/87e6d4fc199e560cc686 to your computer and use it in GitHub Desktop.
Save peterlazar1993/87e6d4fc199e560cc686 to your computer and use it in GitHub Desktop.
React HelloWOrld with state
class HelloWorld extends React.Component {
constructor(props) {
super(props);
this.state = {clicks: 0};
}
render() {
return (
<div>
Hello, World! I am {this.props.name}
<span>&nbsp;
+{this.state.clicks}
</span>
</div>
);
}
};
React.render(<HelloWorld name="React"/>, document.getElementById('container-1'));
React.render(<HelloWorld name="React Native"/>, document.getElementById('container-2'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment