What is the purpose of reactive decorators in Shiny?
Reactive decorators (like @reactive.Calc, @reactive.Effect, @reactive.event) are used to mark functions as reactive — meaning Shiny will automatically track their dependencies and re-run them whenever those dependencies change.
difference between @reactive.Calc and @reactive.Effect
@reactive.Calc → returns a value, caches it, and re-runs only when its dependencies change. Used when you need the result elsewhere (like data for a plot).
@reactive.Effect → performs an action, doesn’t return a value, and re-runs when dependencies change. Used for side effects (logging, writing files, showing a message)
What is reactive programming in Shiny?
A dependency graph causes outputs to automatically update when inputs change.
How to create an input element in Shiny Express?
Use ui functions like ui.input_select(id, label, choices, selected).
How to access an input value?
Use input.<id>(), e.g., input.selectBox1().</id>
How to create a reactive output?
Decorate a function with @render.<type>, e.g., @render.text or @render.plot.</type>
What must a reactive function return?
An object of the type corresponding to its decorator, e.g. text, plot, or data frame.
What are @render._ decorators used for?
They create UI output elements using the return value of the decorated function.
What is @reactive.calc used for?
Defines a reactive computation whose result can be reused in other reactive functions to avoid duplication.
What is @reactive.effect used for?
Triggers side effects when inputs change but returns no value.
What is @reactive.event(*args) used for?
Makes a function react only to specified dependencies.
What does reactive.value() create?
A reactive object that other reactive functions can depend on, similar to input.
Name some Shiny layout options.
Sidebar layout, Navbars, Tabs, Panels/Cards.
How to structure UI containers in Shiny Core?
Using nested function calls, e.g. ui.sidebar(ui.input_text()).
How to structure UI containers in Shiny Express?
Using Python context managers (with statements).
Main code organization difference between Express and Core?
Express places outputs implicitly; Core requires explicit UI output element definitions linked to reactive functions.
Advantages of Core’s explicit output placement?
Easier to rearrange UI and to pass additional parameters to output elements.
Difference in import statements between Core and Express?
Express:
from shiny.express import input, render, ui.
Core:
from shiny import App, render, ui.
How can you run a Shiny app locally?
shiny run –reload –launch-browser –port=0 app.py
or
via VS Code extension.
Name some Shiny deployment options.
Posit Cloud (shinyapps.io), Hugging Face Spaces, Shinylive, or your own server with Shiny Server.
How does Shiny compare to Streamlit?
Shiny offers fully automatic reactivity and CSS/JS-based layouts; Streamlit is simpler but less reactive.
How does Shiny compare to Dash?
Dash is more flexible but requires manual callbacks; Shiny is easier for automatic reactivity.
How does Shiny compare to tkinter?
tkinter is for desktop apps only and lacks web deployment options.
What does it mean to “invalidate” a dependency in Shiny?
a) a reactive value has changed
b) an input has changed