So far, we have looked at how reactivity works in Shiny applications. We have learned how to use observe() and isolate(). We will now look in more detail at event-handling. An event can be defined as a reactive value or an expression that triggers other calculations. For example, sometimes we want some actions to happen only after the action button is clicked.
We have already learned to handle events using observe() and isolate(). There are two more methods:
- observeEvent
- eventReactive
These two provide straightforward ways of handling events:
- observeEvent: If we want to perform an action in response to an event, observeEvent is useful. The syntax is as follows:
observeEvent(eventExpr, handlerExpr, event.env = parent.frame(), event.quoted = FALSE, handler.env = parent.frame(), handler.quoted = FALSE, label =...