本文整理匯總了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"));
}