@JsType(isNative=true,
namespace="<global>")
public class ReactDOM
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <P extends HtmlGlobalFields> |
createElement(java.lang.String type,
P props)
Create and return a new ReactElement of the given type.
|
static <P extends HtmlGlobalFields> |
createElement(java.lang.String type,
P props,
react4j.core.ReactElement<?,?>... children)
Create and return a new ReactElement of the given type with specified children.
|
static <P extends HtmlGlobalFields> |
createElement(java.lang.String type,
P props,
java.lang.String value)
Create and return a new ReactElement of the given type with a single text child.
|
static <C> react4j.core.ReactElement<?,?> |
render(react4j.core.ReactElement<?,?> element,
C container)
Render a ReactElement<?, ?> into the DOM in the supplied container and return a reference to
the component (or returns nothing for stateless components).
|
static <C> react4j.core.ReactElement<?,?> |
render(react4j.core.ReactElement<?,?> element,
C container,
react4j.core.Procedure onUpdate) |
static <C> boolean |
unmountComponentAtNode(C container)
Remove a mounted React component from the DOM and clean up its event handlers and state.
|
public static <C> react4j.core.ReactElement<?,?> render(react4j.core.ReactElement<?,?> element, C container)
Render a ReactElement<?, ?> into the DOM in the supplied container and return a reference to the component (or returns nothing for stateless components).
If the ReactElement<?, ?> was previously rendered into container, this will perform an update on it and only mutate the DOM as necessary to reflect the latest React component.
If the optional callback is provided, it will be executed after the component is rendered or updated.
element
- the react element to rendercontainer
- the DOM container to render intopublic static <C> react4j.core.ReactElement<?,?> render(react4j.core.ReactElement<?,?> element, C container, react4j.core.Procedure onUpdate)
public static <C> boolean unmountComponentAtNode(C container)
container
- the DOM container containing the react component to unmounttrue
if the the component was unmounted@Nonnull @JsMethod(namespace="React") public static <P extends HtmlGlobalFields> DOMElement<P> createElement(@Nonnull java.lang.String type, @Nullable P props)
P
- The type of the props. It should match the associated tag name.type
- A HTML tag name (eg. 'div', 'span', etc)props
- The props to pass to the element.@Nonnull @JsMethod(namespace="React") public static <P extends HtmlGlobalFields> DOMElement<P> createElement(@Nonnull java.lang.String type, @Nullable P props, @Nonnull java.lang.String value)
P
- The type of the props. It should match the associated tag name.type
- A HTML tag name (eg. 'div', 'span', etc)props
- The props to pass to the element.value
- The text child.@Nonnull @JsMethod(namespace="React") public static <P extends HtmlGlobalFields> DOMElement<P> createElement(@Nonnull java.lang.String type, @Nullable P props, @Nullable react4j.core.ReactElement<?,?>... children)
P
- The type of the props. It should match the associated tag name.type
- A HTML tag name (eg. 'div', 'span', etc)props
- The props to pass to the element.children
- The child elements.