outputOptions not in list of output objects

Hi,
I have the following code:

library(shiny)

ui <- fluidPage(
  uiOutput("foo")
)

server <- function(input, output) {
  outputOptions(output, "bar", priority = 2)
  
  output$foo <- renderUI({
      uiOutput("bar")
  })
  
  output$bar <- renderUI({
    p("Hello World")
  })
}

shinyApp(ui = ui, server = server)

But I get an error:

Error in .subset2(x, "impl")$outputOptions(name, ...) : 
  bar is not in list of output objects

What did I do wrong?
Best

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.