A DevTools plugin that brings Zustand state debugging capabilities to Expo DevTools, allowing you to inspect and debug your Zustand stores directly in the Expo development environment. This plugin works exactly like the built-in Zustand devtools middleware, with the same API and functionality.
- π State Inspection - View your Zustand store state in real-time
- π― Action Tracking - Monitor state changes and actions with named actions
- π Time Travel Debugging - Navigate through state history using Redux DevTools
- π Expo Integration - Seamlessly integrates with Expo DevTools platform
- π± React Native Support - Works with Expo managed workflow
- π Redux DevTools Core - Leverages Redux DevTools app core for state inspection
- ποΈ TypeScript Support - Full TypeScript support with proper type definitions
- β‘ Production Safe - Automatically disabled in production builds
npm install @csark0812/zustand-expo-devtools
# or
yarn add @csark0812/zustand-expo-devtools
# or
pnpm add @csark0812/zustand-expo-devtoolsTo access the DevTools interface:
- Start your Expo development server (
npx expo start) - Open your app in Expo Go or development build
- Press Shift+M in the Expo development menu to open DevTools
- Navigate to the DevTools plugin to inspect your Zustand stores
import { create } from 'zustand';
import { devtools } from '@csark0812/zustand-expo-devtools';
interface CounterState {
count: number;
increment: () => void;
decrement: () => void;
}
const useCounterStore = create<CounterState>()(
devtools(
(set) => ({
count: 0,
increment: () => set((state) => ({ count: state.count + 1 }), false, 'increment'),
decrement: () => set((state) => ({ count: state.count - 1 }), false, 'decrement'),
}),
{
name: 'counter-store', // Optional: name your store for better debugging
}
)
);This plugin provides the same functionality as Zustand's built-in devtools middleware, but integrated with Expo's DevTools platform:
- Store Integration: Wrap your Zustand store with the
devtoolsmiddleware (same API as Zustand's built-in devtools) - Expo DevTools: Press Shift+M in your Expo development menu to open DevTools
- DevTools Plugin: Navigate to the DevTools plugin to inspect your stores
- Debug: Inspect state, track actions, and time-travel through your store's history
interface DevtoolsOptions {
name?: string; // Store name (default: 'zustand')
enabled?: boolean; // Enable/disable devtools (default: true)
anonymousActionType?: string; // Default action name (default: 'anonymous')
store?: string; // Store identifier
}For better debugging experience, provide action names when updating state:
const useStore = create<State>()(
devtools(
(set) => ({
// ... your state
updateUser: (user) => set({ user }, false, 'updateUser'),
resetState: () => set(initialState, false, 'resetState'),
}),
{ name: 'user-store' }
)
);The plugin works well with other Zustand middleware like immer and persist:
import { create } from 'zustand';
import { immer } from 'zustand/middleware/immer';
import { persist, createJSONStorage } from 'zustand/middleware';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { devtools } from '@csark0812/zustand-expo-devtools';
const useStore = create<State>()(
devtools(
persist(
immer((set) => ({
// ... your state and actions
})),
{
name: 'app-storage',
storage: createJSONStorage(() => AsyncStorage),
}
),
{ name: 'app-store' }
)
);The devtools middleware is automatically disabled in production builds, so you don't need to worry about removing it for production.
- Expo SDK 53+
- Zustand 5.0.5+
- React Native / Expo development environment
This repository contains:
/src- The main devtools plugin source code/webui- The DevTools web UI that connects to Redux DevTools Extension/examples/basic- Example Expo app demonstrating usage
To run the example:
cd examples/basic
npm install
npx expo startTo develop the plugin:
# Install dependencies
npm install
# For development (rebuilds on changes)
npm run build:dev
# Build the plugin
npm run build
# Build the web UI
npm run web:export
# Build everything
npm run build:allDevelopment Workflow: After making changes to the plugin source code, run npm run build:dev in the root folder to rebuild the library. This will update the compiled code that the example app uses for testing your changes.
Contributions are welcome! Please feel free to submit a Pull Request.
This repository uses automated versioning and publishing when PRs are merged to main. The version bump type is determined by PR labels:
majorlabel β Major version bump (e.g., 2.0.0 β 3.0.0) - Breaking changesminorlabel β Minor version bump (e.g., 2.0.0 β 2.1.0) - New featurespatchlabel β Patch version bump (e.g., 2.0.0 β 2.0.1) - Bug fixes (default)
To control the release type:
- Add the appropriate label (
major,minor, orpatch) to your PR - If no label is added, it defaults to a
patchrelease - When the PR is merged, the version will be automatically bumped and published to npm
MIT Β© Christopher Sarkissian
- Zustand - π» Bear necessities for state management in React
- Expo DevTools - Expo's debugging and profiling tools
- Redux DevTools - DevTools core integration
This project was inspired by:
- redux-devtools-expo-dev-plugin - Redux DevTools integration for Expo
- zustand-expo-devtools - Previous Zustand DevTools implementation
Built using:
- Expo DevTools Plugins - Expo's DevTools plugin architecture