React Helpers

Make it easy to use 'React' in R with 'htmlwidget' scaffolds, helper dependency functions, an embedded 'Babel' 'transpiler', and examples.

CRAN_Status_Badge Travis-CI BuildStatus SlackStatus

reactR provides a set of convenience functions for using React in R with htmlwidget constructor templates and local JavaScript dependencies. The React ecosystem is rich with components that can enhance R web and Shiny apps. scaffoldReactWidget() helps build htmlwidgets to integrate these React components as R htmlwidgets. scaffoldReactShinyInput() does the same for Shiny inputs. The local dependency functions are modeled after the html_dependency_* functions from RStudio’s rmarkdown package.


You can install reactR from CRAN with install.packages("reactR"). For the development version, please use devtools as shown below.

# install.packages("devtools")

Creating htmlwidgets with React Components

To wrap a React component as an htmlwidget, please see the tutorial htmlwidgets with reactR. Also, there are a variety of examples in the react-R Github organization.

Shiny Outputs and Inputs

htmlwidgets built with reactR work well in Shiny as outputs. In version 0.4.0 Alan Dipert has added the ability to easily create React-based official Shiny inputs with helpers and scaffolds. Please see the tutorial for more details.


Below are examples of using reactR directly.

  tags$div(id = "app"),
        'Powered by React'
  #add core-js first to work in RStudio Viewer

reactR uses the V8 package if available to transform JSX and ES2015 code with babel.

    tags$div(id = "app"),
      babel_transform('ReactDOM.render(<h1>Powered By React/JSX</h1>,document.getElementById("app"))')
    # add core-js shim first for React in RStudio Viewer

Contributing and Code of Conduct

We welcome contributors and would love your participation. Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by the terms.


reactR 0.4.0

  • Add Shiny input scaffold and functionality; tutorial and pull 22 thanks @alandipert

reactR 0.3.1

  • Update react and react-dom to 16.8.1
  • Add usethis R dependency
  • Ignore node_modules in .Rbuildignore and .gitignore
  • Set {modules:false} in babel_transform to avoid "use strict"; pull 15
  • Use webpack to build react-tools.js; pull 16
  • Attach component to the htmlwidget

reactR 0.3.0

  • Add htmlwidget scaffold and helpers (see tutorial)
  • Update react and react-dom to 16.6.7

reactR 0.2.1

  • Update react and react-dom to 16.6.0

reactR 0.2.0

  • Update react and react-dom to 16.2.0
  • Add core-js shim so that React will show up in RStudio Viewer

reactR 0.1.4

  • Update react and react-dom to 16.1.1

reactR 0.1.3

  • Update react and react-dom to 16.0.0
  • Update babel to 6.26.0

reactR 0.1.2

  • Update to react 15.5.0
  • Update to babel 6.24.0
  • Add office-fabric-react example
  • Build doc site with pkgdown

reactR 0.1.1

  • Added a file to track changes to the package.
  • Provide offline babel-standalone for babel_transform

reactR 0.1.0

  • Initial release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.4.4 by Kent Russell, 7 months ago

Report a bug at

Browse source code at

Authors: Facebook Inc [aut, cph] (React library in lib ,; see AUTHORS for full list of contributors) , Michel Weststrate [aut, cph] (mobx library in lib , , Kent Russell [aut, cre] (R interface) , Alan Dipert [aut] (R interface)

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports htmltools

Suggests htmlwidgets, rmarkdown, shiny, V8, knitr, usethis, jsonlite

Imported by JBrowseR, aceEditor, connectwidgets, rAmCharts4, reactable, shinyChakraSlider, shinyChakraUI, shinyToastify.

Suggested by apsimx.

Enhanced by listviewer.

See at CRAN