Debian Codegraph @

tests/test-modules/12_counter/R/my-module.R

raw
1 mymoduleUI <- function(id, label = "Counter") {
2 ns <- NS(id)
3 tagList(
4 actionButton(ns("button"), label = label),
5 verbatimTextOutput(ns("out"))
6 )
7 }
8
9 mymoduleServer <- function(id) {
10 moduleServer(
11 id,
12 function(input, output, session) {
13 count <- reactiveVal(0)
14 observeEvent(input$button, {
15 count(count() + 1)
16 })
17 output$out <- renderText({
18 count()
19 })
20 count
21 }
22 )
23 }