Skip to content

Instantly share code, notes, and snippets.

@squadwuschel
Created August 27, 2016 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squadwuschel/b8df5080ffa1f04a4cbdf6e8c731f6e2 to your computer and use it in GitHub Desktop.
Save squadwuschel/b8df5080ffa1f04a4cbdf6e8c731f6e2 to your computer and use it in GitHub Desktop.
TypeScript TSX Datei für Hello World React Beispiel
/// <reference path="../typings/tsd.d.ts" />
// A '.tsx' file enables JSX support in the TypeScript compiler,
// for more information see the following page on the TypeScript wiki:
// https://github.com/Microsoft/TypeScript/wiki/JSX
var Counter = React.createClass({
add: () => {
console.log('add 1!');
},
render: function () {
return <div>
<h1>Counter</h1>
<button onClick={this.add}>+</button>
</div>
}
});
ReactDOM.render(<Counter />, document.getElementById('example'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment