So I was able to return array from action and reducer in static class / function and now I want to render that data inside a data property of MenuItems (https://docs.sencha.com/extreact/6.5.0/modern/Ext.menu.Item.html). I feel I need to set the properties in tpl inline function, but I don't know how. This is what I have tried so far (read the comments):
function ShortcutComponent({ usershortcuts }) {
console.log(usershortcuts); // I get an array
return (
<Button ui="headerButton" arrow={false} ripple={false} iconCls="icon-directions" border={false} handler={() => this.loadData()}>
<Menu title="Shortcuts">
<MenuItem data={usershortcuts} tpl={function(data){
setIconCls(data.shortcutDefinition.iconCls); // I can't use setIconCls
setText(data.shortcutDefinition.description); // I can't set text
}} />
</Menu>
</Button>
)
}
const mapStateToProps = (state) => {
return {
usershortcuts: state.usershortcuts
}
};
const mapDispatchToProps = (dispatch) => {
return {
actions: bindActionCreators(usershortcutAction, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps) (ShortcutComponent);