I'm working a codebase where it has lots of inconsistency as it has been worked on by multiple different person.
function todos(state = [], action) {
switch (action.type) {
case 'ADD_TODO':
return state.concat([ action.text ])
default:
return state
}
}
Instead of doing concat can I use spread syntax instead?
return [...state, action.text]