本文整理汇总了Java中gwt.react.client.api.ReactDOM类的典型用法代码示例。如果您正苦于以下问题:Java ReactDOM类的具体用法?Java ReactDOM怎么用?Java ReactDOM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReactDOM类属于gwt.react.client.api包,在下文中一共展示了ReactDOM类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onDetach
import gwt.react.client.api.ReactDOM; //导入依赖的package包/类
@Override
public void onDetach() {
ReactDOM.unmountComponentAtNode(container);
super.onDetach();
}
示例8: 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"));
}