@JsType(isNative=true,
namespace="<global>")
public final class React
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static ReactNode |
cloneElement(ReactNode element,
jsinterop.base.JsPropertyMap<java.lang.Object> props)
Clone and return a new ReactElement using element as the starting point.
|
static <T> Context<T> |
createContext(T defaultValue)
Creates a context with specified default value.
|
static ReactNode |
createElement(ComponentConstructorFunction type)
Create a ReactElement for the specified React component with no props or children.
|
static ReactNode |
createElement(ComponentConstructorFunction type,
jsinterop.base.JsPropertyMap<java.lang.Object> props)
Create a ReactElement for the specified React component with no children.
|
static ReactNode |
createElement(ComponentConstructorFunction type,
jsinterop.base.JsPropertyMap<java.lang.Object> props,
elemental2.core.JsArray<ReactNode> children)
Create a ReactElement for the specified React component.
|
static ReactNode |
createElement(ComponentConstructorFunction type,
jsinterop.base.JsPropertyMap<java.lang.Object> props,
ReactNode... children)
Create a ReactElement for the specified React component.
|
static ReactNode |
createElement(ComponentConstructorFunction type,
jsinterop.base.JsPropertyMap<java.lang.Object> props,
ReactNode child)
Create a ReactElement for the specified React component.
|
static ReactNode |
createElement(java.lang.String type,
java.lang.Object props)
Create and return a new ReactElement of the given type.
|
static ReactNode |
createElement(java.lang.String type,
java.lang.Object props,
ReactNode... children)
Create and return a new ReactElement of the given type with specified children.
|
static ReactNode |
createFragment(elemental2.core.JsArray<ReactNode> children)
Create a Fragment with the specified children.
|
static ReactNode |
createFragment(java.util.List<? extends ReactNode> children)
Create a Fragment with the specified children.
|
static ReactNode |
createFragment(ReactNode... children)
Create a Fragment with the specified children.
|
static ReactNode |
createFragment(java.util.stream.Stream<? extends ReactNode> children)
Create a Fragment with the specified children.
|
static ReactNode |
createStrictMode(ReactNode... children)
Create a StrictMode component with the specified children.
|
static boolean |
isValidElement(ReactNode node)
Return true if the specified node is a ReactElement.
|
public static boolean isValidElement(@Nonnull ReactNode node)
node
- the node to test.@JsOverlay public static ReactNode createElement(@Nonnull ComponentConstructorFunction type)
type
- the constructor function for the native React component.@JsOverlay public static ReactNode createElement(@Nonnull ComponentConstructorFunction type, @Nullable jsinterop.base.JsPropertyMap<java.lang.Object> props)
type
- the constructor function for the native React component.props
- the props to pass to the component.public static ReactNode createElement(@Nonnull ComponentConstructorFunction type, @Nullable jsinterop.base.JsPropertyMap<java.lang.Object> props, @Nullable ReactNode child)
type
- the constructor function for the native React component.props
- the props to pass to the component.child
- the child of the react component.@JsOverlay public static ReactNode createElement(@Nonnull ComponentConstructorFunction type, @Nullable jsinterop.base.JsPropertyMap<java.lang.Object> props, @Nonnull elemental2.core.JsArray<ReactNode> children)
type
- the constructor function for the native React component.props
- the props to pass to the component.children
- the children of the react component.public static ReactNode createElement(@Nonnull ComponentConstructorFunction type, @Nullable jsinterop.base.JsPropertyMap<java.lang.Object> props, @Nonnull ReactNode... children)
type
- the constructor function for the native React component.props
- the props to pass to the component.children
- the children of the react component.@Nonnull public static ReactNode createElement(@Nonnull java.lang.String type, @Nullable java.lang.Object props)
type
- A HTML tag name (eg. 'div', 'span', etc)props
- The props to pass to the element.@Nonnull @JsMethod public static ReactNode createElement(@Nonnull java.lang.String type, @Nullable java.lang.Object props, @Nullable ReactNode... children)
type
- A HTML tag name (eg. 'div', 'span', etc)props
- The props to pass to the element.children
- The child elements.@JsOverlay public static ReactNode createStrictMode(@Nonnull ReactNode... children)
children
- the child nodes.@JsOverlay public static ReactNode createFragment(@Nonnull ReactNode... children)
children
- the child nodes.@JsOverlay public static ReactNode createFragment(@Nonnull elemental2.core.JsArray<ReactNode> children)
children
- the child nodes.createElement(ComponentConstructorFunction, JsPropertyMap, ReactNode...)
@JsOverlay public static ReactNode createFragment(@Nonnull java.util.List<? extends ReactNode> children)
children
- the child nodes.createElement(ComponentConstructorFunction, JsPropertyMap, ReactNode...)
@JsOverlay public static ReactNode createFragment(@Nonnull java.util.stream.Stream<? extends ReactNode> children)
children
- the child nodes.createElement(ComponentConstructorFunction, JsPropertyMap, ReactNode...)
@Nonnull public static <T> Context<T> createContext(T defaultValue)
T
- the type of the context.defaultValue
- the default value.@JsOverlay public static ReactNode cloneElement(@Nonnull ReactNode element, @Nullable jsinterop.base.JsPropertyMap<java.lang.Object> props)
element
- the element to cloneprops
- the props to merge