Rewrite redux-orm reducer with redux-toolkit

时光毁灭记忆、已成空白 提交于 2020-05-15 04:21:07
问题 Issue (tl;dr) How can we create a custom redux-orm reducer with redux-toolkit's createSlice? Is there a simpler, recommended, more elegant or just other solution than the attempt provided in this question? Details The example of a custom redux-orm reducer looks as follows (simplified): function ormReducer(dbState, action) { const session = orm.session(dbState); const { Book } = session; switch (action.type) { case 'CREATE_BOOK': Book.create(action.payload); break; case 'REMOVE_AUTHOR_FROM