pluginagentmarketplace/custom-plugin-react-native

react-native-state

Master state management - Redux Toolkit, Zustand, TanStack Query, and data persistence

First seen Jan 21, 2026

Installation

$ npx skills add pluginagentmarketplace/custom-plugin-react-native --skill react-native-state

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from pluginagentmarketplace/custom-plugin-react-native.

npx skills add pluginagentmarketplace/custom-plugin-react-native

Browse all from pluginagentmarketplace/custom-plugin-react-native

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 10
License LICENSE
Default branch main
Open issues 1
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

Version2.0.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,235 B
  • docs SUMMARY.md 112 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 37 installs

SKILL.md

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

// 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

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

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),
    }
  )
);

4. TanStack Query

import { useQuery, useMutation } from '@tanstack/react-query';

export function useProducts() {
  return useQuery({
    queryKey: ['products'],
    queryFn: () => api.getProducts(),
    staleTime: 1000 * 60 * 5, // 5 minutes
  });
}

export function useCreateProduct() {
  const queryClient = useQueryClient();

  return useMutation({
    mutationFn: api.createProduct,
    onSuccess: () => {
      queryClient.invalidateQueries({ queryKey: ['products'] });
    },
  });
}

5. When to Use What

Solution Use Case
useState/useReducer Component-local state
Zustand Simple global state, preferences
Redux Toolkit Complex app state, large teams
TanStack Query Server state, caching, sync
Context Theme, auth status (low-frequency)

Quick Start Example

// Zustand + TanStack Query combo
import { create } from 'zustand';
import { useQuery } from '@tanstack/react-query';

// UI state with Zustand
const useUIStore = create((set) => ({
  sidebarOpen: false,
  toggleSidebar: () => set((s) => ({ sidebarOpen: !s.sidebarOpen })),
}));

// Server state with TanStack Query
function ProductList() {
  const { data, isLoading } = useQuery({
    queryKey: ['products'],
    queryFn: fetchProducts,
  });

  const sidebarOpen = useUIStore((s) => s.sidebarOpen);

  // Render with both states
}

Common Errors & Solutions

Error Cause Solution
"Non-serializable value" Functions in Redux state Use middleware ignore
State not persisting Wrong storage config Check persist config
Stale data Missing invalidation Add proper query keys

Validation Checklist

  • State updates correctly
  • Persistence works across restarts
  • Server state syncs properly
  • TypeScript types are correct

Usage

Skill("react-native-state")

Bonded Agent: 03-react-native-state