Hey everyone, I was just reading the docs here and I noticed that it used @callback
instead of @app.callback
when it came to the callback for the page routing. Was wondering if anyone could help me figure out what the distinction between them is and when I should use which one? I was under the impression that @callback
was useful primarily within AllInOne components, so I was surprised to see it in documentation of multipage applications. Thanks!
Hi,
The @callback
decorator was added in dash v2.0 (see more info here), so the short answer is that you should use it for dash>=2.0.0
.
To my knowledge, this is just a convenience to avoid importing the app
object when the application is defined across multiple files, like in a multi-page application (or AIO). For single scripts both approaches are equal.
I guess it is just a matter of time to see more parts of the documentation using @callback
.
2 Likes
Hello @dash-beginner
You can find more information here:
https://community.plotly.com/t/dash-2-0-prerelease-candidate-available/55861