Why I stopped using useState for everything in React 👇 I was doing this in EVERY component: const [isLoading, setIsLoading] = useState(false) const [data, setData] = useState(null) const [error, setError] = useState(null) const [page, setPage] = useState(1) const [filters, setFilters] = useState({}) 5 useState calls for related data. 😅 My components were a mess. Here's what I do now: ✅ Related state → useReducer const [state, dispatch] = useReducer(reducer, { isLoading: false, data: null, error: null }) ✅ Server state → React Query // No useState needed at all! const { data, isLoading, error } = useQuery( ['users'], fetchUsers ) ✅ Global state → Zustand // Cleaner than Redux // No boilerplate! The rule I follow now: → 1-2 simple values = useState ✅ → Related/complex state = useReducer ✅ → API data = React Query ✅ → Global state = Zustand ✅ My components went from 100 lines to 40 lines. 🚀 Are you still using useState for everything? Comment below! 👇 #ReactJS #JavaScript #Frontend #WebDevelopment #ReactHooks #CleanCode
You forgot about useContext(), nice pattern too .🙂
Nice advices
useState is great — but not for everything! This one change made my code significantly cleaner. 🚀 What state management do you prefer?