Plotly Dash 布局和组件之间的概念区别是什么?

What is the conceptual difference between a Plotly Dash layout and a component?

Plotly Dash 布局和组件之间的概念boundary/difference是什么?

即在哪些情况下我应该使用 ReactJS(如 https://dash.plotly.com/plugins ) and in which cases should I make a layout or part of it re-usable by wrapping it into a plain old Python function (as described in the Reusable Components section under https://dash.plotly.com/layout 中所述)制作一些 可重复使用的自定义组件?

TLDR;尝试在 Dash 中创建布局。如果它不起作用、性能不佳或需要大量 hack,请创建一个 React 组件。

根据经验,只要可以,我就会在 Dash 中使用布局。仅仅是因为与编写 React 组件相比,创建布局的过程(至少对我而言)要快得多。这是我首先使用 Dash 的主要原因之一。

更详细一点,有很多事情你不能在达世币中做(或者那些很乏味,表现不佳and/or需要精心设计的技巧) .典型的例子是双向状态同步和与需要将函数句柄作为参数传递的库的交互(这在 Dash 中是不可能的)。在这些情况下,React 组件是最好(唯一)的选择。