25+ ways to handle state in a React app in 2024: React: useState useReducer...
25+ ways to handle state in a React app in 2024:
React:
useState
useReducer
useRef
useContext (to share useState, useReducer, etc)
useOptimistic
useSyncExternalStore
useActionState
React Server component (just return fetch result)
General:
Redux
Jotai
Zustand
Valtio
Mobx
Recoil
XState
Remote state:
Tanstack query
swr
Apollo
RTK query
Forms:
Formik
React Hook Form
Routers:
React Router loader
Remix loader
Tanstack Router loader
Web platform:
URL
Cookie
localStorage
sessionStorage
indexDB
And this only a partial list of the most popular options!
Also, I'm publishing a course that covers a few of my favorite third-party state options later this month.
The course will cover:
Jotai
Zustand
Valtio
Tanstack Query