Skip to main content

Posts

Showing posts from January, 2021

React useReducer hook and how to use it in a small and big application

some little intro about  mutation in javascript  //befor starting object are mutable means you can change it //deep copy a object first way //1 const  objectA  =   {  a :   100 ,  b :   100   }; const  objectB  =   {   ... objectA  }; objectB . a  =   200 ; console . log ( objectB ); //2nd const  objectC  =   {   a :  objectA . a ,   b :  objectA . b }; objectC . a  =   1000 ; console . log ( objectC ); console . log ( objectA ); //another way to create deep copy nested object let  nobject  =   {   a :   10 ,   b :   20 ,   c :   {     name :   "manish" ,     age :   21    },   arr :   [ 1 ,   2 ,   3 , ...