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.
我知道您可以通过将映射作为 :init-state 关键字的值传递来启动组件的状态。但是通过将此映射作为 :state 关键字的值传递,例如,在组件与其子组件之间,现在它们可以共享相同的状态了吗?是这样吗?谢谢。
不同之处在于子状态何时设置。
:init-state
:state
因此,:init-state应该用于(顾名思义),初始化状态。另一方面,:state用于设置随时间变化的状态。