title: ShinyApp: keep dynamically generated input values from being lost
body: <p>I have some inputs that are generated or eliminated if some <code>actionButtons</code> are activated. However, the input value is reset each time any <code>actionButton</code> is activated. I know this is because the inputs are rendered each time one of the <code>actionButton</code> are pressed. So is there a way to get a hold of the values selected? I though of render each on his own <code>uiOutput</code>, but I don't know how to do that dynamically as in this approach. That or any other implementation is greatly appreciated.</p>
  <p>Reprex:</p>
  <pre><code>library(shiny)
  
  ui &lt;- fluidPage(
    actionButton(&quot;addInput&quot;, &quot;Agregar&quot;),
    actionButton(&quot;removeInput&quot;, &quot;Eliminar&quot;),
    uiOutput(&quot;inputs&quot;),
    h3(&quot;When you select any value from any input and then press an actionButton, the values are lost because the inputs are rendered once again. How can I keep the values selected even after adding or deletion of a new input?&quot;)
  )
  
  server &lt;- function(input, output, session) {
    
    i &lt;- reactive({
      i &lt;- input$addInput - input$removeInput
      if(i &lt;= 0 ){
      i &lt;- 1 }
      return(i)
    })
    
    output$inputs &lt;- renderUI({
      if (is.null(i())) return(NULL)
      tagList(
        lapply(1:i(),function(j){
          
      shiny::selectInput(paste0('vble_',i()[j]), '', choices = c(LETTERS))
        })
      )
    })
  }
  
  shinyApp(ui, server)
  </code></pre>