Skip to content

Commit e0f62a6

Browse files
committed
Small enhancements suggested by @cpsievert
1 parent c31d721 commit e0f62a6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

R/reacttools.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ component <- function(name, varArgs = list()) {
2525
if (length(name) == 0 || !isUpper(substring(name, 1, 1))) {
2626
stop("Component name must be specified and start with an upper case character")
2727
}
28-
htmltools::tag(name, varArgs)
28+
component <- htmltools::tag(name, varArgs)
29+
structure(component, class = c("reactR_component", oldClass(component)))
2930
}
3031

3132
#' React component builder.
@@ -76,15 +77,16 @@ React <- structure(
7677
#' Prepare data that represents a single-element character vector, a React
7778
#' component, or an htmltools tag for sending to the client.
7879
#'
80+
#' Tag lists as returned by \code{\link[htmltools]{tagList}} are not currently
81+
#' supported.
82+
#'
7983
#' @param tag character vector or React component or
8084
#' \code{\link[htmltools]{tag}}
8185
#'
8286
#' @return
8387
#' @export
84-
#'
85-
#' @examples
8688
reactMarkup <- function(tag) {
87-
stopifnot(class(tag) == "shiny.tag"
89+
stopifnot(inherits(tag, "shiny.tag")
8890
|| (is.character(tag) && length(tag) == 1))
8991
list(tag = tag, class = "reactR.markup")
9092
}

0 commit comments

Comments
 (0)