Preview:
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]

    }
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter