I am a little bit confused with the difference of app.Callback Input and State. Let’s say there are two options for a range slider when the callback is fired:
Input('my-range-slider', 'value'),
State('my-range-slider', 'value')
What is the practical difference between each? When should one use over the other?
2 Likes
Inputs
will trigger your callback; State
do not. If you need the the current “value” - aka State
- of other dash components within your callback, you pass them along via State
.
See https://dash.plot.ly/state for some examples.
1 Like
What you said does make sense. So using state could reduce the number of callbacks which gives a better performance?
Not sure I follow that. Depending on how you construct your callbacks, and how much data you pass around, could affect performance. Your callbacks are triggered whenever the Input
conditions are met; generally speaking, I don’t see how including (or not including) State
parameters will provide better performance.