# extendify/0.2.0/src/state/GlobalState.js

Extendify, version 0.2.0. 37 lines.

- Page: https://pluginprobe.com/plugins/extendify/0.2.0/code/src/state/GlobalState.js
- Raw: https://pluginprobe.com/plugins/extendify/0.2.0/raw/src/state/GlobalState.js
- Modified: 2022-01-06T18:08:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/0.2.0/code/src/state/GlobalState.js#L10-L20`.

```javascript
import create from 'zustand'
import { persist } from 'zustand/middleware'

export const useGlobalStore = create(
    persist(
        (set) => ({
            open: false,
            metaData: {},
            // These two are here just to persist their previous values,
            // but could be refactored to be the source instead.
            // It would require a refactor to state/Templates.js
            currentTaxonomies: {},
            currentType: 'pattern',
            settingsModal: false,
            currentModal: null,
            updateCurrentTaxonomies: (data) =>
                set({
                    currentTaxonomies: Object.assign({}, data),
                }),
            updateCurrentType: (data) => set({ currentType: data }),
            setOpen: (value) => {
                set({ open: value })
            },
            setCurrentModal: (value) => {
                set({ currentModal: value })
            },
        }),
        {
            name: 'extendify-global-state',
            partialize: (state) => {
                delete state.currentModal
                return state
            },
        },
    ),
)

```
