[英]REACT.JS Passing a State through Components
You should really look into using Redux for global state management. 您应该真正考虑使用Redux进行全局状态管理。 It's got a bit of a learning curve but it is 100% worth it for this exact usage.
它有一点学习曲线,但对于这个确切的用法它是100%值得的。 The other way is have your state be at the top most component (Panel) and you can pass down whatever state your need to down as props to all the child components.
另一种方法是让你的状态处于最顶层组件(Panel),你可以将你需要的状态传递给所有子组件作为道具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.