Adapted from RemcoProgrammer's answer here:
Use Case | Solution | Example |
---|---|---|
Backend Cache | React Query, Apollo Client | fetch response |
Navigation State | React Router | URL, params, history state |
Component State (and subtree) | useState, custom hooks | is this thing currently open, what are the form contents and errors, what page of the table are we looking at |
Unchanging Global State | useContext | auth, theme, language choice |
Changing Global State | Redux, Zustand | dashboard data |