How does state management work in React Native?
Why Interviewers Ask This
Interviewers use this question to quickly assess whether a candidate has the foundational knowledge required for React Native development. It reveals whether you understand the building blocks that more complex concepts rely on.
Answer
React Native uses the same state management patterns as React web — the same libraries work without modification. 1. useState (local state): component-level state. Best for UI state, form values, toggles: const [isLoading, setIsLoading] = useState(false);. 2. useContext (shared state): share state across component tree without prop drilling: const ThemeContext = React.createContext("light"); function App() { return ( <ThemeContext.Provider value="dark"> <Screen /> </ThemeContext.Provider> ); } function Screen() { const theme = useContext(ThemeContext); }. 3. Redux Toolkit (complex global state): for large apps with complex state: npm install @reduxjs/toolkit react-redux. Same setup as React web. Works perfectly in React Native. 4. Zustand (simpler alternative to Redux): import { create } from "zustand"; const useStore = create(set => ({ bears: 0, addBear: () => set(state => ({ bears: state.bears + 1 })) })); // In component: const { bears, addBear } = useStore();. 5. Jotai / Recoil (atomic state): atomic state management — similar to useState but shareable. 6. MobX (reactive): observable state, automatic tracking. What to use: useState for local; Context for small shared state; Zustand/Redux Toolkit for complex global state. React Query / TanStack Query for server state (caching, refetching, loading states). Most React Native apps use: useState + Context + React Query (or SWR) + Zustand/Redux Toolkit for different layers.
Common Mistake
Rushing to answer is a common mistake. Take two seconds to structure your response: definition → example → trade-off. This structure makes complex React Native answers easy to follow.