Package react4j
Class Context<T>
java.lang.Object
react4j.Context<T>
@JsType(isNative=true,
namespace="<global>",
name="Object")
public final class Context<T>
extends Object
Context is designed to share data that can be considered "global" for a tree of views.
In a typical React application, data is passed top-down (parent to child) via inputs, but this can
be cumbersome for certain types of inputs (e.g. locale preference, UI theme) that are required by
many views within an application. Context provides a way to share values like this between
views without having to explicitly pass a input through every level of the tree.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A Builder for the Consumer component.static interface
Interface used to type the render function input.static final class
A Builder for the Provider component. -
Constructor Summary
-
Method Summary
-
Constructor Details
-
Context
public Context()
-
-
Method Details
-
provider
Create a builder for the Provider component.- Returns:
- a builder for the Provider component.
-
provide
Create a provider component that provides specified value to specified children.- Parameters:
value
- the value to provider to children.children
- the child elements.- Returns:
- the element.
-
consumer
Create a builder for the Consumer component.- Returns:
- a builder for the Consumer component.
-