问题:
My structure looks as follows:我的结构如下:
Component 1
- |- Component 2
- - |- Component 4
- - - |- Component 5
Component 3
Component 3 should display some data depending on state of Component 5.组件 3 应根据组件 5 的状态显示一些数据。
Since props are immutable, I can't simply save its state in Component 1 and forward it, right?由于 props 是不可变的,我不能简单地将它的状态保存在组件 1 中并转发它,对吗? And yes, I've read about Redux , but I don't want to use it.是的,我读过Redux ,但我不想使用它。 I hope that it's possible to solve it just with react.我希望可以通过反应来解决它。 Am I wrong?我错了吗?
解决方案:
参考一: https://en.stackoom.com/question/2P6r7参考二: https://stackoom.com/question/2P6r7