Exercise

Delay reactions with eventReactive()

Shiny's reactive programming framework is designed such that any changes to inputs automatically updates the outputs that depend on it. In some situations, we might want to explicitly control the trigger that causes the update.

The function eventReactive() is used to compute a reactive value that only updates in response to a specific event.

rval_x <- eventReactive(input$event, {
 # calculations
})

Instructions

100 XP
  • Use eventReactive() to delay the execution of computing BMI until the user clicks on the button.