State Management in react
State management in React involves handling data that changes over time. Local state uses useState, shared state can use Context API or lifting state up. For complex apps, libraries like Redux, Zustand, or Jotai provide global state management with predictable patterns.
Example
// Zustand store example
import { create } from 'zustand';
const useStore = create((set) => ({
count: 0,
increment: () => set((s) => ({ count: s.count + 1 })),
}));Zustand provides a minimal API for global state management without the boilerplate of Redux.