A Pen by AmiraAmin

PHOTO EMBED

Sun Jun 13 2021 13:41:07 GMT+0000 (UTC)

Saved by @amiraamin #undefined

console.clear();

//people droppig a form (action creator)

const creatPolicy =(name,amount)=>{

  return{//action(form in our analogy)

    type:'CREATE_Policy',

    payload:{

      name,amount

    }  

  }  

}

​

const deletePolicy =(name,amount)=>{

  return{//action(form in our analogy)

    type:'DELETE_Policy',

    payload:{

      name,amount

    }  

  }  

}

​

const creatClaim =(name,amountOfMoneytoCollect)=>{

  return{//action(form in our analogy)

    type:'CREATE_CLAIM',

    payload:{

      name,amountOfMoneytoCollect

    }  

  }  

}

//reducer department

 const ClaimHistory =(oldListOfClaim=[],form)=>{

   if(action.type===CREATE_CLAIM)

    { //we care about this action

       return [...oldListOfClaim ,action.payload]

    }
content_copyCOPY

https://codepen.io/amiraamin12/pen/Popxqep?editors