Shiny reactive problem


#1

Hi guy, I have a problem about ReactiverValues.

Sure, . Note that values taken from the reactiveValues object are reactive, but the reactiveValues object itself is not..

The thing is when I start to run the following code. There are two results show in RStudio Console:

[1] "I am here"
[1] "You are here"

What does it exactly do during the starting? why the two observes got triggered in the first place?

Best regards,
Song

I mean, why?

ui = fluidPage(
        sidebarPanel(
            numericInput("number" ,"set a number", 1))
)

server = function(input, output, session) {
    reac <- reactiveValues(a = 1, b = 1)
    
    observe({
        reac$a <- isolate(input$number)
        print("I am here")
    })
    
    observe({ 
        reac$b
        print("You are here")
    })  
    
}
shinyApp(ui, server)