App 1: UI function

  1. Create a function with the id argument.
  2. Wrap all components in the tagList function to bundle together multiple components without actually implying how they’ll be laid out.
  3. Wrap each inputId using the next structure NS(id, "id_name").
histogramUI <- function(id) {
  tagList(
    selectInput(NS(id, "var"), "Variable", choices = names(mtcars)),
    numericInput(NS(id, "bins"), "bins", value = 10, min = 1),
    plotOutput(NS(id, "hist"))
  )
}