如何在组件之间发送动作?
How to send actions between components?
文档 explains how to send an action to self
但是我找不到如何将操作发送到另一个组件。现在我把我所有的应用程序放在一个大的 reducerComponent
中,但我真的很想能够有一个带有一些按钮的菜单组件和一个用于主游戏区域的其他组件,并改变按钮主游戏区域的状态。
它与 React 非常相似,在 Thinking in React 中有详细描述
React is all about one-way data flow down the component hierarchy. It may not be immediately clear which component should own what state. This is often the most challenging part for newcomers to understand...
您应该将处理程序和状态从父组件向下传递给子组件。可以找到很好的例子 here。
文档 explains how to send an action to self
但是我找不到如何将操作发送到另一个组件。现在我把我所有的应用程序放在一个大的 reducerComponent
中,但我真的很想能够有一个带有一些按钮的菜单组件和一个用于主游戏区域的其他组件,并改变按钮主游戏区域的状态。
它与 React 非常相似,在 Thinking in React 中有详细描述
React is all about one-way data flow down the component hierarchy. It may not be immediately clear which component should own what state. This is often the most challenging part for newcomers to understand...
您应该将处理程序和状态从父组件向下传递给子组件。可以找到很好的例子 here。