简体   繁体   English

如何在不连接和调用的情况下将道具推送到组件? 另一页

[英]How to push props to component without any connection and calls? Another page

How to push props to component without any connection and calls? 如何在不连接和调用的情况下将道具推送到组件? Another page I have profile and company employees structure i wanna do button what will show to users theirs place in structure, but this is two pages without any render and connections or calls like <OrgStructure employeeCode="test"/> 另一个页面我有个人资料和公司员工结构我想做按钮会向用户显示结构中的位置,但这是两页没有任何渲染和连接或调用如<OrgStructure employeeCode="test"/>

If you have two Components that share common state but can't be directly coupled, you should use a global state container of whom both Components can read from. 如果您有两个共享公共状态但无法直接耦合的组件,则应使用两个组件都可以读取的全局状态容器。

You should check out https://react-redux.js.org/ . 你应该看看https://react-redux.js.org/ It provides a global state container called "redux store". 它提供了一个名为“redux store”的全局状态容器。 Components can independently subscribe to the store and get updated whenever the data in the store changes. 组件可以独立订阅商店,并在商店中的数据发生变化时进行更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM