本文整理汇总了Java中gwt.react.client.api.ReactDOM.render方法的典型用法代码示例。如果您正苦于以下问题:Java ReactDOM.render方法的具体用法?Java ReactDOM.render怎么用?Java ReactDOM.render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gwt.react.client.api.ReactDOM
的用法示例。
在下文中一共展示了ReactDOM.render方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onModuleLoad
import gwt.react.client.api.ReactDOM; //导入方法依赖的package包/类
@Override
public void onModuleLoad() {
StatefulExample.Props statefulCompProps = new StatefulExample.Props();
statefulCompProps.aProp = "aPropValue";
DOMElement<HtmlProps> appComp =
div(null,
React.createElement(ChildApiTests::countChildrenComponent, null,
div(null, "Child 1"),
div(null, "Child 2")
),
React.createElement(ChildApiTests::childArrayTestComponent, null,
div(null, "Array Child 1"),
div(null, "Array Child 2"),
div(null, "Array Child 3 (should be the last child)")
),
React.createElement(ChildApiTests::updatePropsOfChildrenComponent, null,
div(null, "Child 1 should be red"),
div(null, "Child 2 should be red (should be the last child)")
),
React.createElement(StatefulExample.class, statefulCompProps),
//The following creates an element using a ComponentConstructorFn
React.createElement(StatefulExample2.class, null)
);
ReactDOM.render(appComp, Document.get().getElementById("mainCont"), () -> Window.alert("Rendered"));
Window.alert("renderToString returned: '" + ReactDOMServer.renderToString(div(null, "a div")) + "'");
}
示例2: onModuleLoad
import gwt.react.client.api.ReactDOM; //导入方法依赖的package包/类
@Override
public void onModuleLoad() {
StatefulExample.Props statefulCompProps = new StatefulExample.Props();
statefulCompProps.aProp = "aPropValue";
DOMElement<HtmlProps> appComp =
div(null,
React.createElement(ChildApiTests.countChildrenComponent, null,
div(null, "Child 1"),
div(null, "Child 2")
),
React.createElement(ChildApiTests.childArrayTestComponent, null,
div(null, "Array Child 1"),
div(null, "Array Child 2"),
div(null, "Array Child 3 (should be the last child)")
),
React.createElement(ChildApiTests.updatePropsOfChildrenComponent, null,
div(null, "Child 1 should be red"),
div(null, "Child 2 should be red (should be the last child)")
),
React.createElement(StatefulExample.class, statefulCompProps)
);
ReactDOM.render(appComp, Document.get().getElementById("mainCont"), () -> Window.alert("Rendered"));
Window.alert("renderToString returned: '" + ReactDOMServer.renderToString(div(null, "a div")) + "'");
}
示例3: onModuleLoad
import gwt.react.client.api.ReactDOM; //导入方法依赖的package包/类
@Override
public void onModuleLoad() {
Store<TodoAppReducer.State> store = Redux.createStore(TodoAppReducer.todoApp);
ReactDOM.render(
React.createElement(ReactRedux.Provider, new ProviderProps().Store(store),
React.createElement(App.component, null)
),
Document.get().getElementById("root"));
}
示例4: render
import gwt.react.client.api.ReactDOM; //导入方法依赖的package包/类
private void render() {
MouseEventHandler onIncrement = (e) -> store.dispatch(makeAction("INCREMENT"));
MouseEventHandler onDecrement = (e) -> store.dispatch(makeAction("DECREMENT"));
ReactDOM.render(
React.createElement(Counter.class,
$(new BaseProps(),
"value", store.getState(),
"onIncrement", onIncrement,
"onDecrement", onDecrement)
), Document.get().getElementById("root"));
}
示例5: onModuleLoad
import gwt.react.client.api.ReactDOM; //导入方法依赖的package包/类
@Override
public void onModuleLoad() {
AppState appState = new AppState();
//Force the use of actions
MobX.useStrict(true);
ReactDOM.render(
div(null,
//Show Dev tools toolbar
React.createElement(MobXDevTools.component, $(new BaseProps(), "hightlightTimeout", 4000)),
React.createElement(App.class, $(new AppStateProps(), "appState", appState))
),
Document.get().getElementById("mainCont"));
}
示例6: onAttach
import gwt.react.client.api.ReactDOM; //导入方法依赖的package包/类
@Override
public void onAttach() {
super.onAttach();
ReactDOM.render(elementToRender, container);
}
示例7: render
import gwt.react.client.api.ReactDOM; //导入方法依赖的package包/类
private void render() {
ReactDOM.render(
React.createElement(Router, new RouterProps().History(ReactRouter.hashHistory),
castAsReactElement(routes)),
Document.get().getElementById("todoapp"));
}