html_dependency_react: Dependencies for React

Description Usage Arguments Value Examples

View source: R/dependencies.R

Description

Add JavaScript 'React' dependency. For this to work in RStudio Viewer, also include html_dependency_corejs.

Usage

1

Arguments

offline

logical to use local file dependencies. If FALSE, then the dependencies use the Facebook cdn as its src. To use with JSX see babel_transform.

Value

htmlDependency

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(reactR)
library(htmltools)

tagList(
  tags$script(
  "
    ReactDOM.render(
      React.createElement(
        'h1',
        null,
        'Powered by React'
      ),
      document.body
    )
  "
  ),
   #add core-js first to work in RStudio Viewer
  html_dependency_corejs(),
  html_dependency_react() #offline=FALSE for CDN
)

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