I am new to Shiny and playing around with the interface. I thought I would try and make a simple click counter app, where a textOutput displays the number of clicks on an actionButton.
I have the following in the ui.R file
textOutput("clickCount")
actionButton("clickBtn", "Click")
In the server.R file I have
library(shiny)
clickCounter <- 0
shinyServer(function(input, output) {
output$clickCount <- renderText({
input$clickBtn
clickCounter <- isolate(clickCounter + 1)
clickCounter
})
})
First of all, when the app loads the textOutput displays 1 and not 0. Secondly, nothing happens to the clickCounter when I click the button. I wanted to increase the number in textOutput("clickCount") by 1 every time the button is clicked.. is it possible or am I chasing windmills? :)
Thanks,
Dennis