Closed Bookcliff closed 2 years ago
You can close this once you can answer the following questions:
Use object destructuring when you need to separate out properties, values, etc. held within the object. This is helpful when you need to parse out a specific property from an object (or value from array).
Yes. Are you able to write a few examples of object destructuring here?
const arr = [1, 2]; const [a, b] = arr;
console.log(a); // 1 console.log(b); // 2
const russell = { age: 25, gender: 'male' };
const {age, gender} = russell; console.log(age); // 25 console.log(gender); // male
Amazing. Importing files works the same way. Depending on how a component is imported you do either
import {button} from './file' vs import button from './file'