window.addEventListener('load', () => { render(MainApp({}), document.getElementById('app')); }, false);
/// <reference path="../typings/tsd.d.ts" /> import * as React from 'react'; interface TextAreaCounterProps extends React.Props<any> { text: string; } interface TextAreaCounterState { } class TextAreaCounter extends React.Component<TextAreaCounterProps, TextAreaCounterState>{ render(){ return React.DOM.div(null, React.DOM.textarea({ defaultValue: this.props.text }), React.DOM.h3(null, this.props.text.length)); } } React.render(React.createElement(TextAreaCounter, {text: "Bob" }), document.getElementById("app"));
function run() { render( createElement(App, {}), document.getElementById('app')) }
/// <reference path="../typings/tsd.d.ts" /> import * as React from 'react'; interface MyComponentProps extends React.Props<any> { name: string; } class MyComponent extends React.Component<MyComponentProps, {}>{ render(){ return React.DOM.span(null, this.props.name); } } React.render(React.createElement(MyComponent, {name: "I'm so custom" }), document.getElementById("app"));
import * as React from 'react'; import * as Rx from 'rx'; import App from './app'; const RxDOM = require('rx-dom'); React.render( React.createElement(App, {}), document.getElementById('app'));
var React : any = require('react'); var AppComponent : any = require('./component/AppComponent.jsx'); var host = location.origin.replace(/^http/, 'ws'); React.render( React.createElement(AppComponent, { 'API' : host }), document.getElementById('content'));
import * as React from 'react'; import Square from 'Square'; import View from 'View'; let square = new Square(5); console.log('square area', square.size, square.getArea()); React.render( React.createElement(View, {name: 'Priit', age: 23}), document.getElementById('app') );
output$.subscribe((comp: React.ReactElement<any>) => { React.render( comp, document.getElementById('app')) });
// browserify.js (our library that clumps together all these javascript files) // needs a "main file" to derive all dependencies from and package up. // This is that file. /// <reference path="../common/def/node.d.ts"/> var React: any = require('react'); var AppComponent: any = require('./component/AppComponent.jsx'); React.render( React.createElement(AppComponent), document.getElementById('content') );
/** * Created by shearerbeard on 6/16/15. */ ///<reference path="../typings/references.d.ts"/> import * as React from "react"; import {alt} from "./alt"; import {MainComponent} from "./components/Main"; React.render( React.jsx(`<MainComponent />`), document.getElementById("app") );