rn-state-management
Installation
SKILL.md
React Native State Management
Instructions
Split state into two kinds: client state (UI, session, local forms) and server state (remote data). Never conflate them.
- Client state ->
zustand(default),@reduxjs/toolkitfor large teams already on Redux, orjotaifor atom-granular state. - Server state ->
@tanstack/react-queryv5.
1. Zustand (Preferred Default)
// src/features/cart/model/cartStore.ts
import { create } from 'zustand';
import { persist, createJSONStorage } from 'zustand/middleware';
import { mmkvStorage } from '@infrastructure/storage/mmkv';
type CartItem = { id: string; qty: number };