Firing redux actions from the application menu
slightlytyler opened this issue · 8 comments
What's the preferred way of hooking the application menu into redux? I've implemented undo / redo but am having trouble firing the actions from the menu click. It would be nice to have an example of this included in the repo
@jhen0409 I am interested in #108 however I would like to see the starter include an example of how to accomplish it without redux-electron-store.
In my app I created a function bindStoreToMenu
that is called when the store is configured. Also created a middleware undoRedoMenuState
to properly set the enabled boolean for the menu items.
https://github.com/slightlytyler/mocksy/blob/master/app/store/bindStoreToMenu.js
https://github.com/slightlytyler/mocksy/blob/master/app/store/undoRedoMenuState.js
Any feedback on my logic is welcome, I'll gladly contribute what I can if this is something the project would like to include
@burkhardr is it possible to do this with electron-redux
?
@amilajack Yeah, couldn't see why not!
Can anyone explain a little bit how this is done with electron-redux
? Do I need to create a container for MenuBuilder just like other components?
never mind, this stackoverflow solution is the simplest. I tried electron-redux
, but in my case it creates some weird sync problem.