import { useReducer } from "react";
import ConstantStateHandler from "./constantStateHandler";
import StateHandler from "./stateHandler";

export default function ClickHandler(initialValue, applyHook) {
  let [state, dispatchVal] = useReducer(StateHandler, initialValue);
  function handleClick(e, type, action) {
    let modifiedState = e;
    ConstantStateHandler(state, modifiedState, dispatchVal, type, applyHook, action);
  }
  return handleClick;
}
