reactR provides a set of convenience functions for using
React ecosystem is
rich with components that can enhance
R web and Shiny apps.
scaffoldReactWidget() helps build
htmlwidgets to integrate these
React components as
does the same for
Shiny inputs. The local dependency functions are
modeled after the
html_dependency_* functions from RStudio’s
You can install reactR from CRAN with
the development version, please use
devtools as shown below.
# install.packages("devtools") devtools::install_github("react-R/reactR")
reactable is a very well-built
htmlwidget leveraging this functionality.
htmlwidgets built with
reactR work well in Shiny as outputs. In
0.4.0 Alan Dipert has added the ability to easily create
Shiny inputs with helpers and scaffolds. Please
for more details.
Below are examples of using
library(reactR) library(htmltools) browsable(tagList( tags$div(id = "app"), tags$script( " ReactDOM.render( React.createElement( 'h1', null, 'Powered by React' ), document.getElementById('app') ) " ), #add core-js first to work in RStudio Viewer html_dependency_corejs(), html_dependency_react() ))
reactR uses the
V8 package if available to transform
ES2015 code with
library(reactR) library(htmltools) browsable( tagList( tags$div(id = "app"), tags$script( babel_transform('ReactDOM.render(<h1>Powered By React/JSX</h1>,document.getElementById("app"))') ), # add core-js shim first for React in older versions of RStudio Viewer #html_dependency_corejs(), html_dependency_react() ) )
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.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.