ES6構文の「...」(スプレッド演算子)
reducers にある ...state の ... ってなに?
case UPDATE: return { ...state, list: action.payload.list };
↓と同じ
return Object.assign({}, state, { list: action.payload.list })
普通だったらこうなるものを
var parts = ['shoulder', 'knees']; var lyrics = ['head', parts, 'and', 'toes']; console.log(lyrics); > [ 'head', [ 'shoulder', 'knees' ], 'and', 'toes' ]
これでできちゃう
var lyrics = ['head', ...parts, 'and', 'toes']; console.log(lyrics); > [ 'head', 'shoulder', 'knees', 'and', 'toes' ]
Redux のうんぬんではなく、 ES6 の構文。スプレッド演算子というらしい。