I'm trying to follow todo-app with react. I am writing "update all as completed" function, in flux.
while in redux todomvc example, todos are array
state = [{id: 1, text: "Read flux", completed: false}, ...]
so they use this method
const areAllMarked = state.every(todo => todo.completed)
return state.map(todo => Object.assign({}, todo, {
completed: !areAllMarked
}))
https://github.com/reactjs/redux/blob/master/examples/todomvc/reducers/todos.js
but i am using todos as a Object like {id: todo}
state = {1: {text: "Read flux", completed: false}, ...}
then, is there any proper, functional way to get updated object with Object.assign
?