text: import { useState } from 'react';
  import initialState from '../initialState';
  
  export const useInitialState = () => {
      const [state, setState] = useState(initialState);
  
      const addTotal = (total) => {
          setState({
              ...state,
              totalValue: total,
          })
      }
  
      const useCoupon = (code, percent) => {
          setState({
              ...state,
              couponCode: code,
              couponPercent: percent
          })
          console.log(state);
      }
  
      const getNewTotal = (total, percent) => {
          console.log("INPUT::", total, percent);
          let discount = percent / 100;
          let newTotal = total - (total * discount)
          console.log("NEWTOTAL::", newTotal);
          return newTotal.toFixed(2);
      }
  
      const clearTotal = () => {
          setState({
              ...state,
              totalValue: 0
          })
      }
  
      return {
          addTotal,
          clearTotal,
          useCoupon,
          getNewTotal,
          state
      }
  };
  