spread operator use in reactjs

We can use spread operator to add two array

const result = [...arr1, ...arr2];

We can copy/clone one array/object to other variable

const arr3 = [...arr1];
const obj1 = {...obj1};

Extend array value

const arr4 = [ 1, 3 , ...arr1];


function myFunction(...theArgs) {
 // 
 }

in react we can pass all props using sprad property &lgt

Comments

Popular posts from this blog

world tourism guide Template

Es6 how to check if value is not null or undefined?