-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
добавил стэйт для корзины
- Loading branch information
Showing
7 changed files
with
61 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Нашёд баг и за useEfect итемка при изменение состояния рендерится 2 раза |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; | ||
import { PizzaState } from "../../components/main/pizzaTypes"; | ||
|
||
interface Items { | ||
buyItems: PizzaState[]; | ||
} | ||
|
||
const initialState: Items = { | ||
buyItems: [], | ||
}; | ||
|
||
const buyState = createSlice({ | ||
name: "buyItems", | ||
initialState, | ||
reducers: { | ||
addItem: (state, action: PayloadAction<PizzaState>) => { | ||
state.buyItems.push(action.payload); | ||
}, | ||
}, | ||
}); | ||
|
||
export const { addItem } = buyState.actions; | ||
export default buyState.reducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters