'How to use a reactive expression in updateSelectInput?

I know that reaction expressions must be used in reactive contexts and updateSelectInput is not a reactive context. I have used a reprex below but in my real application i get some data processed in a reactive() way. I want to use the first column of that data to be used in my select input and i cannot figure out how to do that:

ui = fluidPage(
  selectInput("state", "Choose a state:",choices = NULL
              
  ),
  textOutput("result")
)

server <- function(input, output, session) {
  
    
    updateSelectInput(session, "state",
                      choices = hello())
    hello<-reactive({mtcars[1]})
    
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source