11/8/2022 0 Comments Redux dispatch![]() Return the new state, Never mutate the older state.įor more complex apps use combineReducers() to combine them so that it can pass to store. Same for remove, if none of the above two then just return the list. Then check the action type, different type of actions will have different functionality, In the above case if task is added, then it returns the array containing older list of task and with one new added, but the older state are not gonna mutate the older state we gonna return new one, this is needed to be kept in mind. So, In the above reducer, a function created with two arguments first is the current state and next is the action we want to perform, First initialize the current state empty array because at first task list is gonna be empty.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |