(인프런:한입 크기로 잘라 먹는 리액트 React.js기초 => Props => 4:05 캡쳐)
[ES6] Spread Operator(스프레드 연산자)
const slime = {
name: '슬라임'
};
const cuteSlime = {
...slime,
attribute: 'cute'
};
const purpleCuteSlime = {
...cuteSlime,
color: 'purple'
};
console.log(slime); {name: '슬라임'}
console.log(cuteSlime);{name: '슬라임', attribute: 'cute'}
console.log(purpleCuteSlime);{name: '슬라임', attribute: 'cute', color: 'purple'}
const animals = ['개', '고양이', '참새'];
const anotherAnimals = [...animals, '비둘기'];
console.log(animals); ['개', '고양이', '참새']
console.log(anotherAnimals); ['개', '고양이', '참새', '비둘기']
**https://paperblock.tistory.com/62