Skip to content

marcoSven/create-zustand-store-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-zustand-store-context

AbortController hook

NPM JavaScript Style Guide

Install

npm install --save create-zustand-store-context

Usage

import { createZustandStoreContext } from "create-zustand-store-context";

type Store = {
  value: boolean;
};

const initialState: Store = {
  value: false,
};

const { storeContext, useState, useStore } =
  createZustandStoreContext<Store>(initialState);

const StoreContext = storeContext;

function Provider({ children }: WithChildren) {
  const currentStore = useStore();

  return (
    <StoreContext.Provider value={currentStore}>
      {children}
    </StoreContext.Provider>
  );
}

export { Provider, useState };

License

MIT © marcoSven

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published