import { create } from "zustand";
import { immer } from "zustand/middleware/immer";

const store = (set) => ({
  popup: null,

  setPopup: (popupState) => {
    set((state) => {
      if (!popupState) {
        state.popup = null;
        return state;
      }
      state.popup = popupState;
    });
  },
});

export const usePopup = create(immer(store));
