Component Data
component-data.Rd
Data is used for a component's internal state and can also be used to pass information from a parent component to its children. Both component templates and methods have access to component data.
Details
Creating data
To create component data, define a function that returns a list of named objects. These objects can be Shiny reactive objects, data frames, lists, or any other R object.
For instance, the following is a valid data function:
function() {
list(
rctv = shiny::reactiveVal(),
df = mtcars
)
}
Accessing data
Data can be accessed in both the methods and template parts of the component via the self
keyword.
For example, the following component defines the data foo
, and accesses it in the template via self$foo
.
See also
Other components:
component-methods
,
component-styles
,
component-template
,
component()