Should I store function references in Redux store?

后端 未结 3 1233
悲哀的现实
悲哀的现实 2020-12-03 06:50

I\'m trying to build keyboard shortcut support into my React/Redux app in an idiomatic React/Redux way. The way I am planning to do this is

3条回答
  •  不思量自难忘°
    2020-12-03 06:57

    No, you should not store function references in the redux store. They are not serializable, and as you mentioned state should be serializable at all time. The most redux friendly approach I can think of is just to keep the map of hotkeys to their actionCreatorFuncNames.

提交回复
热议问题