当前位置: 首页>>代码示例>>Java>>正文


Java ReactDOM类代码示例

本文整理汇总了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")) + "'");
}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:31,代码来源:App.java

示例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")) + "'");
}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:29,代码来源:App.java

示例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"));
}
 
开发者ID:GWTReact,项目名称:gwt-redux,代码行数:11,代码来源:Index.java

示例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"));
}
 
开发者ID:GWTReact,项目名称:gwt-redux,代码行数:13,代码来源:App.java

示例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"));
}
 
开发者ID:GWTReact,项目名称:gwt-mobx,代码行数:16,代码来源:Index.java

示例6: onAttach

import gwt.react.client.api.ReactDOM; //导入依赖的package包/类
@Override
public void onAttach() {
    super.onAttach();
    ReactDOM.render(elementToRender, container);

}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:7,代码来源:ReactPanel.java

示例7: onDetach

import gwt.react.client.api.ReactDOM; //导入依赖的package包/类
@Override
public void onDetach() {
    ReactDOM.unmountComponentAtNode(container);
    super.onDetach();
}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:6,代码来源:ReactPanel.java

示例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"));
}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:7,代码来源:App.java


注:本文中的gwt.react.client.api.ReactDOM类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。