bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/React/React Core
React•React Core

React ES6 Spread Operator

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind React ES6 Spread Operator?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ numbersOne = [1, 2, 3];
3Order

Put the learning moves in the order that makes the concept easiest to apply.

We can use the spread operator with objects too:
The spread operator is often used in combination with destructuring.
The JavaScript spread operator ( .

Spread Operator

The JavaScript spread operator ( ... ) copies all or part of an existing array or object into another array or object.

Example

const numbersOne = [1, 2, 3];
const numbersTwo = [4, 5, 6];
const numbersCombined = [...numbersOne, ...numbersTwo];

The spread operator is often used in combination with destructuring.

numbers

We can use the spread operator with objects too:

Example

const car = {
  brand: 'Ford', model: 'Mustang', color: 'red'
}
const car_more = {
  type: 'car', year: 2021, color: 'yellow'
}
const mycar = {...car, ...car_more}

Notice that the properties that did not match were added, and the property that did match was overwritten by the last object.

Previous

React ES6 Destructuring

Next

React ES6 Modules