I am using the answer of the following code to create an arbitrary number of action events ushing this code:
Dynamic number of actionButtons tied to unique observeEvent
What I would like to do is now used the observe event to change a reactive value, so this part of the code:
local({
i <- ii
observeEvent(eventExpr = input[[paste0("button",i)]],
handlerExpr = {print(sprintf("You clicked btn number %d",i))
my_reactive() <- i
})
})
The problem is that i get the following error:
Warning: Error in <-: invalid (NULL) left side of assignment
[No stack trace available]
I presume that its because of the scoping of using local, but cant find a way to either remove the local part.