• Stars
    star
    334
  • Rank 126,264 (Top 3 %)
  • Language
    TypeScript
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Inspect your zustand store in React DevTools πŸ»βš›οΈ

simple-zustand-devtools

Inspect your zustand store in React DevTools πŸ»βš›οΈ

Usage

import create from 'zustand';
import { mountStoreDevtool } from 'simple-zustand-devtools';

export const useStore = create(set => {
  // create your zustand store here
});

if (process.env.NODE_ENV === 'development') {
  mountStoreDevtool('Store', useStore);
}

Mount more than one store

mountStoreDevtool creates a new HTML element with id: simple-zustand-devtools-${storeName}, where storeName is a name provided as the first argument. You can mount more than one store, as long as store names remain unique. For example:

import create from 'zustand';
import { mountStoreDevtool } from 'simple-zustand-devtools';

export const useStore1 = create((set, get) => {
  // create your zustand store here
});

export const useStore2 = create((set, get) => {
  // create your zustand store here
});

if (process.env.NODE_ENV === 'development') {
  mountStoreDevtool('Store1', useStore1);

  mountStoreDevtool('Store2', useStore2);
}

Installation

For React 18+

yarn add simple-zustand-devtools --dev

For React 17

Use a 1.0.1 release (or lower) for React 17.

npm install [email protected] --save-dev --legacy-peer-deps

Docs

mountStoreDevtool

import { StoreApi } from 'zustand';

type ZustandStore = StoreApi<Record<string | number | symbol, any>>;

export function mountStoreDevtool(
  storeName: string,
  store: ZustandStore,
  rootElement?: HTMLElement
): void;

Local Development

Below is a list of commands you will probably find useful.

npm start or yarn start

Runs the project in development/watch mode. Project will be rebuilt upon changes.

npm run build or yarn build

Bundles the package to the dist folder. The package is optimized and bundled with Rollup into multiple formats (CommonJS, UMD, and ES Module).

npm test or yarn test

Runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.

More Repositories

1

theme-ui-sketchy

Sketchy Theme UI Preset
TypeScript
201
star
2

use-comments

React hook to effortlessly add a comment section to your website, and start the discussion on your content.
TypeScript
171
star
3

semantic-search

πŸ•΅οΈβ€β™€οΈ An OpenAI-powered CLI to build a semantic search index from your MDX files.
TypeScript
93
star
4

tsc-diagnostics-diff-action

TypeScript
65
star
5

animated-emojis

Animated emojis πŸ˜’πŸ’—πŸ˜‘πŸ˜¨πŸ˜Š
TypeScript
43
star
6

edgedb-ai-booking-assistant

AI Booking Assistant with EdgeDB and Vercel AI SDK
TypeScript
33
star
7

go-group-imports-vscode

VSCode extension for separating imports in go files into three groups: stdlib, 3rd party, own.
TypeScript
31
star
8

olang

a minimal programming language written in TypeScript with ts-parsec
TypeScript
23
star
9

wtf-js-quiz

TypeScript
23
star
10

aleksandra.codes

personal website
MDX
19
star
11

no-profanity

No more bad words in your console logs!
TypeScript
10
star
12

gptql

TypeScript
9
star
13

proof-checker

Proof checker for natural deduction in propositional logic
OCaml
9
star
14

next13-blitz-auth

TypeScript
9
star
15

hasura-interactive-cli

TypeScript
8
star
16

ts-performance-talk

TypeScript
8
star
17

diversity.lol

TypeScript
6
star
18

text-to-graphql

TypeScript
6
star
19

ocaml-parser-example

OCaml
5
star
20

everybody-gives-astro-supabase

TypeScript
5
star
21

supabase-realtime-math-game

TypeScript
5
star
22

ts-workshops

TypeScript
5
star
23

blog

TypeScript
4
star
24

pp6

Haskell
2
star
25

chatty

gRPC + elixir
Elixir
2
star
26

hasura-vscode

TypeScript
2
star
27

adventofcode2020

Rust
2
star
28

fets-spotify-demo-app

TypeScript
2
star
29

wroc-ts-08-talk

TypeScript
2
star
30

ai-project

C#
1
star
31

personal-blog

TypeScript
1
star
32

go-fixer-api

Go
1
star
33

ts-in-css-css-prop

Created with CodeSandbox
TypeScript
1
star
34

everybody-gives-ui

TypeScript
1
star
35

numerical-analysis-app

TypeScript
1
star
36

graphiql-gpt-plugin

TypeScript
1
star
37

savant

CSS
1
star
38

css-to-js-vscode

TypeScript
1
star
39

codingame-ES6-eslint-babel-webpack-starter

Minimal starter for sane coding in JavaScript on CodinGame.
JavaScript
1
star
40

tag-sql

πŸ’₯Build sql queries for mysqljs in a safe and comfortable way
TypeScript
1
star
41

backend-interview-questions-and-answers

1
star
42

ink-examples

TypeScript
1
star
43

mips-assembler

Python
1
star
44

algorithms

TypeScript
1
star
45

go-rest-openapi

Go
1
star
46

hackathon

TypeScript
1
star
47

aleksandrasays

Personal site
TypeScript
1
star