React has over a dozen popular third-party state libraries


React has over a dozen popular third-party state libraries. React Query, Zustand, Redux, Jotai, Mobx, etc.

Prediction: Third-party React state libraries will become less relevant in 2024.

Why? I see two things "eating" this space:

1. Routers are becoming state managers. Example: @tan_stack router has built in loaders and caching.

2. React Server Components (RSC). RSC enables server-side fetching and caching. Example: @nextjs.

@tan_stack query already taught us - *most state is server state* (data fetched from a server). Both 1 and 2 above handle "server state".

The result: There's typically little state left to manage except for forms, which can typically be handled locally via useState, useReducer, or a form library like React Hook Form.

And there's little need for a global data library, since most global data is "server state" anyway. React's built-in context is often sufficient for any remaining global data. Most global data changes infrequently (user, language, theme, etc), so React's context can handle it.

Bottom line: In 2024, we're less likely to need third-party React state libraries.

The React ecosystem keeps innovating. 👍
I forgot to mention another reason third-party state may be less necessary in 2024: React forget (the auto-memoizing compiler), which is expected later this year. As React's built-in performance improves, using a third party library for performance reasons will be less necessary.

Also, note that in the initial tweet above I said "less relevant", not irrelevant. Many React apps will continue to use third-party state libraries. I'm just predicting fewer apps will *need* to in 2024.

View original on X