mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-29 16:58:11 -05:00
Add note about reactive world
This commit is contained in:
@@ -103,6 +103,16 @@ Here is the new graph structure:
|
||||

|
||||
|
||||
|
||||
Keep in mind that if your application tries to access reactive values or expressions from outside a reactive context — that is, outside of a reactive expression or observer — then it will result in an error. You can think of there being a reactive "world" which can see and change the non-reactive world, but the non-reactive world can't do the same to the reactive world. Code like this will not work, because the call to `fib()` is not in the reactive world, but it tries to access some that is, the reactive value `input$n`:
|
||||
|
||||
{% highlight r %}
|
||||
shinyServer(function(input, output) {
|
||||
currentFib <- fib(as.numeric(input$n))
|
||||
output$nthValue <- renderText({ currentFib })
|
||||
})
|
||||
{% endhighlight %}
|
||||
|
||||
|
||||
### Summary
|
||||
|
||||
In this section, we've learned about:
|
||||
|
||||
Reference in New Issue
Block a user