The concept of reactivity
Shiny uses a reactive programming model, and this is a big deal. By applying reactive programming, the framework is able to be fast, efficient, and robust. Briefly, changing the input in the user interface, Shiny rebuilds the related output. Shiny uses three reactive objects:
Reactive source
Reactive conductor
Reactive endpoint
For simplicity, we use the formal signs of the RStudio documentation:
The implementation of a reactive source is the reactive value; that of a reactive conductor is a reactive expression; and the reactive endpoint is also called the observer.
The source and endpoint structure
As taught in the previous section, the defined input of the ui.R
links is the output of the server.R
file. For simplicity, we use the code from our first Shiny app again, along with the introduced formal signs:
... output$carsPlot <- renderPlot({ hist(mtcars[,input$variable], main = "Histogram of mtcars variables", ...