makeReactiveBinding: Make a reactive variable

View source: R/reactives.R

makeReactiveBindingR Documentation

Make a reactive variable

Description

Turns a normal variable into a reactive variable, that is, one that has reactive semantics when assigned or read in the usual ways. The variable may already exist; if so, its value will be used as the initial value of the reactive variable (or NULL if the variable did not exist).

Usage

makeReactiveBinding(symbol, env = parent.frame())

Arguments

symbol

Name of variable to make reactive, as a string.

env

Environment in which to create binding. Expert use only.

Value

None.

Examples

reactiveConsole(TRUE)

a <- 10
makeReactiveBinding("a")

b <- reactive(a * -1)
observe(print(b()))

a <- 20
a <- 30

reactiveConsole(FALSE)

rstudio/shiny documentation built on Nov. 8, 2024, 6 a.m.