react-community-tools-practices-cheatsheet icon indicating copy to clipboard operation
react-community-tools-practices-cheatsheet copied to clipboard

Category: State Management

Open markerikson opened this issue 4 years ago • 8 comments

Add pages covering purpose, capabilities, tradeoffs, and use cases for common state management tools.

Initial examples:

  • https://react-community-tools-practices-cheatsheet.netlify.app/state-management/overview
  • https://react-community-tools-practices-cheatsheet.netlify.app/state-management/redux

Likely items to cover:

  • [x] Overview
  • [ ] React components
  • [x] Redux
  • [ ] Mobx
  • [x] XState
  • [ ] Zustand
  • [ ] Jotai/Recoil
  • [ ] others?

markerikson avatar Nov 19 '21 00:11 markerikson

Hi Mark, At @pmndrs, we often got asked about our three different state management libraries and which to choose. We know the necessity of such guidance. Just recently, while discussing with @Sajad-Sharhani, he's pretty motivated to provide some comparison to help better understand them. While our focus is to give guidance for zustand, jotai and valtio, comparing them with other libraries such as Redux would also be helpful to the community. So, I wonder if we can actually contribute to the effort in this project. How can we proceed? Can we just send a PR? (Oh, I just found #10, which is a very recent activity.)

dai-shi avatar Feb 22 '22 23:02 dai-shi

Yes! Really what this project needs now is just people to write content pages and submit PRs! :)

My main caveats are:

  • I don't want this to turn into "let's add a separate page for every library in the React ecosystem". There needs to be some decent amount of curation. (This also presents the problem of "well, now you've made it into just some advertisements for the libraries that are already popular", which I agree is also a concern. We'll worry about that more after this actually starts to get filled out!)
  • I want to make sure each page presents a good balanced description of "what kind of tool is this and what problems does it solve?", plus "when should you consider using it, and when should you consider not using it?". Given that it's my idea, I figure the best option is for me to provide editorial guidance of any PRs.
  • I haven't yet figured out how we'll deal with "comparing between different libraries of the same category" yet either

So yes, I would absolutely welcome some writeups on the three pmndrs libs. I can see a good argument for putting them on the same page together, in that they are from the same org and present different APIs and tradeoffs.

markerikson avatar Feb 23 '22 00:02 markerikson

I can see a good argument for putting them on the same page together

Hm, yeah, that sounds better and it's probably easier for us to write a self-contained doc. @Sajad-Sharhani So, let's start?

dai-shi avatar Feb 23 '22 00:02 dai-shi

Sure, I will start working on it

Sajad-Sharhani avatar Feb 23 '22 00:02 Sajad-Sharhani

Hi Mark, So the plan is to make a category for pmndrs and in it make pages for every lib?

Sajad-Sharhani avatar Feb 24 '22 01:02 Sajad-Sharhani

For now, let's say one new page with all three of those together. I think there's a couple reasons why that might be better:

  • Since they are all from the same org, and I know I've seen people asking "what's the difference between them?", it would probably be easier to explain if they're on the same page
  • Usage-wise, Jotai and Valtio are much smaller, so I don't think they need their own page atm.

markerikson avatar Feb 24 '22 01:02 markerikson

Just out of curiosity I went and checked for NPM download stats of several libs:

https://npm-stat.com/charts.html?package=%40reduxjs%2Ftoolkit&package=mobx&package=zustand&package=jotai&package=recoil&from=2021-01-01&to=2022-02-23

image

(and Valtio is half of Jotai, at 35K DLs/week).

markerikson avatar Feb 24 '22 02:02 markerikson

I dunno if we're going to want to get to the point of actually comparing libraries, but just saw this post that does some good categorizations of how libs store state ("store, atom, etc"), read state, and update state, and covers several different libraries. Very well written!

https://albertgao.xyz/2022/02/19/react-state-management-libraries-2022/

markerikson avatar May 19 '22 03:05 markerikson