We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
You can continue the conversation there. Go to discussion →
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { Collection, CollectionItem, ContainerNode } from "./types"; import { create } from "zustand"; import { devtools } from "zustand/middleware"; type State = { collection: Collection; user: string; }; type Actions = { addContainerNode: () => void; removeContainerNode: (idx: number) => void; }; const n = new Map<string, ContainerNode>(); n.set("lol", { title: "new", content: "new", }); const initialCollection = [n]; export const useCollectionStore = create<State & Actions>()( devtools((set) => ({ user: "dasked", collection: initialCollection, addContainerNode: () => set((state) => { const temp = [...state.collection, n]; return { ...state, collection: temp }; }), removeContainerNode: (idx) => set((s) => { const temp = s.collection.filter((_, i) => i != idx); return { ...s, collection: temp }; }), })), );
the collection is empty object in state , but it should be some sort of map ! i'm not sure how to get the behavior i want
i want to store array of Map in my collection in store.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
the collection is empty object in state , but it should be some sort of map !
i'm not sure how to get the behavior i want
i want to store array of Map in my collection in store.
The text was updated successfully, but these errors were encountered: