Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的通量应用程序显示一个列表位置。当用户点击一个位置时,它会变为“活动”。一次只能有一个活动位置。
位置状态应该是位置本身的属性(例如location.active)还是应该是全局状态的一部分,例如activeLocationId?
location.active
activeLocationId
我已经编写了该应用程序的几个变体。很明显,这active不是项目本身的属性(location在这种情况下),而是 UI 的属性(activeLocationId)。
active
location
一些好处: