UNPKG

@datalayer/core

Version:
22 lines (21 loc) 591 B
/* * Copyright (c) 2023-2025 Datalayer, Inc. * Distributed under the terms of the Modified BSD License. */ import { createStore } from 'zustand/vanilla'; import { useStore } from 'zustand'; export const cellStore = createStore((set, get) => ({ cell: undefined, create: (cell) => set((state) => ({ cell })), update: (cell) => set((state) => ({ cell: cell ? { ...state.cell, ...cell, } : undefined })), })); export function useCellStore(selector) { return useStore(cellStore, selector); } export default useCellStore;