In my Shiny app I have UI generated with React.js scripts. I include them in my fluidPage
using tags$script
. On the page there is also an actionButton
. On the server side I have an observeEvent
function that should print 10
to the RStudio console every time the button is clicked. I have noticed that including the React scripts breaks binding between the button and the server. Commenting out the last tags$script
will make the click event observable again, but the UI is then not loaded. I tried to open the page in Chrome, then put Shiny.bindAll();
in console, but it didn't change anything.
ui.R
ui <- fluidPage(
actionButton("but","Hey"),
tags$div(id="root"),
#React scripts
tags$script(src="static/js/inline.js"),
tags$script(src="static/js/2.210fc6f9.chunk.js"),
tags$script(src="static/js/main.fd6ab614.chunk.js"),
)
server.R
server <- function(input, output) {
observeEvent(input$but, {
print(10)
})
}