component: Create a React component

Description Usage Arguments Value Examples

View source: R/reacttools.R

Description

Create a React component

Usage

1
component(name, varArgs = list())

Arguments

name

Name of the React component, which must start with an upper-case character.

varArgs

Attributes and children of the element to pass along to tag as varArgs.

Value

An htmltools tag object

Examples

1
2
3
4
5
6
7
8
component("ParentComponent",
  list(
    x = 1,
    y = 2,
    component("ChildComponent"),
    component("OtherChildComponent")
  )
)

Example output

<ParentComponent x="1" y="2">
  <ChildComponent></ChildComponent>
  <OtherChildComponent></OtherChildComponent>
</ParentComponent>

reactR documentation built on Feb. 22, 2021, 5:05 p.m.