Javascript 如何在基于函数的组件中使用此.executeAction(“someAction”)?
我有一个基于类的组件,其中我通过一个操作调用redux存储Javascript 如何在基于函数的组件中使用此.executeAction(“someAction”)?,javascript,reactjs,react-redux,redux-saga,fluxible,Javascript,Reactjs,React Redux,Redux Saga,Fluxible,我有一个基于类的组件,其中我通过一个操作调用redux存储 class App extends Component { //Calling Constructor & setting State & other things this.executeAction("someAction"); } 我想知道这个功能组件的替代方案是什么。 注意:-我不确定它是否是某个库。您可以使用useDipatchhook fromreact redux 从'react re
class App extends Component {
//Calling Constructor & setting State & other things
this.executeAction("someAction");
}
我想知道这个功能组件的替代方案是什么。
注意:-我不确定它是否是某个库。
您可以使用
useDipatch
hook fromreact redux
从'react redux'导入{useDispatch}
函数App(){
//调用构造函数、设置状态和其他事情
const dispatch=usedpatch()
派遣(“某些行动”)
}