我在不同的组件中有两种形式。我正在另一个组件中显示结果。我正在使用<Form>来自react-router-dom. 并使用获取数据action。如果我采取一项行动,效果很好。所以我尝试添加一个额外的action,比如,
{
path: '/show-result`,
element: <ShowResult />,
action: actionFromFirstComponent,
action: actionFromSecondComponent
}
Run Code Online (Sandbox Code Playgroud)
它没有按预期工作。我也尝试过action: [actionFromFirstComponent, actionFromSecondComponent]。但react-router-dom引发了我的handler is not a function错误。
我尝试在谷歌的反应路由器路由中搜索多个操作。但是,它只展示了如何为一个组件设置多个路由。