'Accessing value from another slice

Hello I am using Redux Toolkit. I would like to access values from another slice in another slice. Or it is just more convenient to stay in one big slice?

first slice

 const INITIAL_VALUE = {
      recipes: [] as Recipe[],
      filteredRecipes: [] as Recipe[],
      likedRecipes: {
        recipes: [] as Recipe[],
        totalAmount: 0,
      },
      recipeTypes: ["Breakfast", "Lunch", "Dinner", "Supper"], // tutaj dodaj czas i typy
      recipeTime: [
        "Very short (~30min)",
        "short (~1hr)",
        "medium (~3hrs)",
        "Long (~6hrs)",
      ],
    };

second slice
const INITIAL_STATE = {
  filteredRecipes = Recipes[]
};


const secondSlice = createSlice({
  name: "ui",
  initialState: INITIAL_STATE,
  reducers: {
    filterItems(state, action) {
state.filteredRecipes = recipes.filter(recipe => ???) // I want to access recipes from the first slice.
  },
});


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source