Stashed / app / src / redux / modals / addItemModalSlice.js
addItemModalSlice.js
Raw
import { createSlice } from "@reduxjs/toolkit";

const addItemModalSlice = createSlice({
  name: "addItemModal",
  initialState: {
    visibility: false,
  },
  reducers: {
    openModal(state, action) {
      state.visibility = true;
    },
    closeModal(state, action) {
      state.visibility = false;
    },
  },
});

// Export actions
export const { openModal, closeModal } = addItemModalSlice.actions;

// Export reducer
export default addItemModalSlice.reducer;