Created
August 27, 2016 21:54
-
-
Save squadwuschel/b8df5080ffa1f04a4cbdf6e8c731f6e2 to your computer and use it in GitHub Desktop.
TypeScript TSX Datei für Hello World React Beispiel
This file contains 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
/// <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