Created
September 28, 2020 04:33
-
-
Save itaditya/c9281d4393dbca3d366b14d6f296d13b to your computer and use it in GitHub Desktop.
(Blog) Build a Redux hooked app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case ACTIONS.LOAD_MENU: { | |
| const { menu } = action.payload; | |
| const menuById = {}; | |
| menu.forEach((item) => { | |
| menuById[item.id] = item; | |
| }); | |
| const allMenuId = menu.map((item) => item.id); | |
| const vegMenuId = menu | |
| .filter((item) => item.diet === "veg") | |
| .map((item) => item.id); | |
| return { | |
| ...state, | |
| menuById, | |
| menuIdList: { | |
| all: allMenuId, | |
| veg: vegMenuId, | |
| }, | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment