本文整理匯總了TypeScript中react.render函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript render函數的具體用法?TypeScript render怎麽用?TypeScript render使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了render函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: render
window.addEventListener('load', () => {
render(MainApp({}), document.getElementById('app'));
}, false);
示例2: render
/// <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"));
示例3: run
function run() {
render(
createElement(App, {}),
document.getElementById('app'))
}
示例4: render
/// <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"));
示例5: require
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'));
示例6: require
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'));
示例7: Square
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')
);
示例8:
output$.subscribe((comp: React.ReactElement<any>) => {
React.render(
comp,
document.getElementById('app'))
});
示例9: require
// 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')
);
示例10:
/**
* 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")
);