Master state management - Redux Toolkit, Zustand, TanStack Query, and data persistence
View on GitHubpluginagentmarketplace/custom-plugin-react-native
react-native-assistant
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/pluginagentmarketplace/custom-plugin-react-native/blob/main/skills/react-native-state/SKILL.md -a claude-code --skill react-native-stateInstallation paths:
.claude/skills/react-native-state/# React Native State Management Skill
> Learn production-ready state management including Redux Toolkit, Zustand, TanStack Query, and persistence with AsyncStorage/MMKV.
## Prerequisites
- React Native basics
- TypeScript fundamentals
- Understanding of React hooks
## Learning Objectives
After completing this skill, you will be able to:
- [ ] Set up Redux Toolkit with TypeScript
- [ ] Create Zustand stores with persistence
- [ ] Manage server state with TanStack Query
- [ ] Persist data with AsyncStorage/MMKV
- [ ] Choose the right solution for each use case
---
## Topics Covered
### 1. Redux Toolkit Setup
```typescript
// store/index.ts
import { configureStore } from '@reduxjs/toolkit';
import { authSlice } from './slices/authSlice';
export const store = configureStore({
reducer: {
auth: authSlice.reducer,
},
});
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
```
### 2. RTK Slice
```typescript
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
interface AuthState {
user: User | null;
token: string | null;
}
export const authSlice = createSlice({
name: 'auth',
initialState: { user: null, token: null } as AuthState,
reducers: {
setUser: (state, action: PayloadAction<User>) => {
state.user = action.payload;
},
logout: (state) => {
state.user = null;
state.token = null;
},
},
});
```
### 3. Zustand Store
```typescript
import { create } from 'zustand';
import { persist, createJSONStorage } from 'zustand/middleware';
import AsyncStorage from '@react-native-async-storage/async-storage';
interface AppStore {
theme: 'light' | 'dark';
setTheme: (theme: 'light' | 'dark') => void;
}
export const useAppStore = create<AppStore>()(
persist(
(set) => ({
theme: 'light',
setTheme: (theme) => set({ theme }),
}),
{
name: 'app-storage',
storage: createJSONStorage(() => AsyncStorage),
}
)
);
```
##