init wishlist, zustand and tanstack
This commit is contained in:
15
ArtisanConnect/store/wishlistStore.jsx
Normal file
15
ArtisanConnect/store/wishlistStore.jsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
export const useWishlist = create((set) => ({
|
||||
wishlistNotices: [],
|
||||
addNoticeToWishlist: (wishlistNotice) =>
|
||||
set((state) => ({
|
||||
wishlistNotices: [...state.wishlistNotices, wishlistNotice],
|
||||
})),
|
||||
removeNoticeFromWishlist: (noticeId) =>
|
||||
set((state) => ({
|
||||
wishlistNotices: state.wishlistNotices.filter(
|
||||
(item) => item.noticeId != noticeId
|
||||
),
|
||||
})),
|
||||
}));
|
||||
Reference in New Issue
Block a user