當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。