An open API service indexing awesome lists of open source software.

https://github.com/joshwrn/zustand-devtools


https://github.com/joshwrn/zustand-devtools

Last synced: 9 months ago
JSON representation

Awesome Lists containing this project

README

          

# Zustand State Inspector

Screenshot 2024-08-09 at 8 33 46 AM

## Installation

```bash
npm install zustand-state-inspector
```

## Usage

```tsx
import { create } from "zustand"
import { ZustandDevTools } from "zustand-state-inspector"

const useYourStore = create((set) => ({
count: 0,
inc: (num) => set((state) => ({ count: state.count + num })),
dec: (num) => set((state) => ({ count: state.count - num })),
}))

const App = () => {
const store = useYourStore()
return (




)
}
```

## Props

| Prop | Description |
| --------------- | ------------------------------------------------------------------------------------- |
| state | The zustand store to inspect |
| showDevTools | Take control of the showDevTools state. Will hide the default icon if it's provided |
| setShowDevTools | If you're passing in showDevTools, you need to pass in a setter function to update it |