![](/img/trans.png)
[英]In ReactJS is component state tied to an instance of the component or is it tied to all instances of the component?
[英]React : How to apply the state change to all instances of a Component, even if the state of any one instance of component is changed?
假設我有一個包含多個 td 的表。 每個 td 都是它自己的一個組件。 如何實現該功能,以便即使 td 之一的狀態發生更改,該狀態更改也應適用於所有其他 td 組件。
秒
您可以將一個 prop 傳遞到與父組件中的 state 相關聯的每個 td 中。
您可能需要深入研究 Redux 或 Context 的 React 狀態管理。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.