Jordan Belford from The Wolf of Wall Street movie. He goes to Switzerland and visits a bank to secure his money. He has written down a list of instructions in a piece of paper. He then creates an account associated with this instructions. The bank has to strictly follow that instructions with regards to his account. Recently in India a guy swindled $2 Billion, so staring Nirav Modi as Jordan Belford as an example let's learn reduxjs.

Reduxjs ft Nirav Modi


<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.7.2/redux.js"></script>
<script>
const niravModiInstructions = (balance = {amount: 11000, name: "Nirav Modi"}, action) => {
    switch (action.type) {
        case "ABORT":
         return {amount: 0, name: "Nirav Modi"}
        default:
            return balance;
    }
};
const swissBankAccount = Redux.createStore(niravModiInstructions)        

console.log('balance', swissBankAccount.getState() )
swissBankAccount.dispatch({type: "ABORT"})
console.log('balance', swissBankAccount.getState() )
</script>
</head>

<body>
  <div id="app">
  </div>
</body>
</html>

Copy, paste the above code in a new index.html file and open your browser console and play with it

So far good, next