I cannot seem to get reactive to work on my shiny app

I have my code written and i am trying to load a new graph based on radio button selection, however, the graph does not change. Only the first graph will load. I am having trouble figuring this out.



           library(shiny)
           library(r2d3)
           library(shinythemes)

           flare<-read.csv("flare.csv")
           flare2<-read.csv("flare2.csv")
           flare3<-read.csv("flare3.csv")

          ui <- fluidPage(theme = shinytheme("darkly"),

            headerPanel(title = "Radial Dendograph"),
 sidebarLayout(
       sidebarPanel(
 
       radioButtons("choice","Desired Domain of Focus", choices = c("SI" = "SI","SA" = 
       "SA","NSSI" = "NSSI"))
       ),

        mainPanel(
       d3Output("d3"), width = 11
       )
       ))

       server <- function(input, output) {

       dat<- reactive({
       if (input$choice =="SI") 
       flare
      else if (input$choice == "SA")
      flare2
     else if (input$choice == "NSSI") 
    flare3
})
 output$d3 <- renderD3({
    r2d3(data = dat(), d3_version = 5, script = "#1.js",css = "#2.css", dependencies = "d3- 
     jetpack")
      })
      }
#runs the app
     shinyApp(ui = ui, server = server)

I doubt you have a radioButton problem, I would guess its a D3 problem. D3 can be quite annoying.
Here's my evidence :

library(shiny)
library(r2d3)
library(shinythemes)
#
# flare<-read.csv("flare.csv")
# flare2<-read.csv("flare2.csv")
# flare3<-read.csv("flare3.csv")

flare <- " Just flare"
flare2 <- "the second flare"
flare3 <- "yet another flare...3"

ui <- fluidPage(
  theme = shinytheme("darkly"),

  headerPanel(title = "Radial Dendograph"),
  sidebarLayout(
    sidebarPanel(
      radioButtons("choice", "Desired Domain of Focus", choices = c(
        "SI" = "SI", "SA" =
          "SA", "NSSI" = "NSSI"
      ))
    ),

    mainPanel(
      textOutput("what_to_show_in_d3")
      # d3Output("d3"), width = 11
    )
  )
)

server <- function(input, output) {
  dat <- reactive({
    if (input$choice == "SI") {
      flare
    } else if (input$choice == "SA") {
      flare2
    } else if (input$choice == "NSSI") {
      flare3
    }
  })
  output$what_to_show_in_d3 <- renderText({
    paste0("You chose ... ", dat())
  })
  #
  # output$d3 <- renderD3({
  #   r2d3(data = dat(), d3_version = 5, script = "#1.js",css = "#2.css", dependencies = "d3-
  #    jetpack")
  # })
}
# runs the app
shinyApp(ui = ui, server = server) 

If you require help with D3, at a minimum we would need a proper Reprex including some minimal version of the input data, in an easy to ingest format, as well as any required component linked in (.js, .css ?)
FAQ: How to do a minimal reproducible example ( reprex ) for beginners