The documentation explains how to send an action to self
however I can't find how to send an action to another component. Right now I'm putting all of my app in a single big reducerComponent
but I'd really like to be able to have a menu component with some buttons and an other component for the main game area and have the buttons change the state of the main game area.
问问题
66 次
1 回答
2
它与 React 非常相似,并且在Thinking in React中有很好的描述为
React 完全是关于沿着组件层次结构的单向数据流。可能无法立即清楚哪个组件应该拥有什么状态。这通常是新手最难理解的部分……
您应该将处理程序和状态都从父组件传递给子组件。很好的例子可以在这里找到。
于 2019-03-05T06:55:50.560 回答