vuejs / vuex

🗃️ Centralized State Management for Vue.js.
https://vuex.vuejs.org
MIT License
28.42k stars 9.58k forks source link

Documenting common Vuex patterns #2058

Open kawazoe opened 3 years ago

kawazoe commented 3 years ago

What problem does this feature solve?

An interesting feature of Redux's documentation is their section on Fundamentals and Standard Patterns. While Vuex have a great API reference and guides to help users use this API, we are left to experiment with Vuex for everything higher-level. For instance:

By reading the doc, you can find some answers to those questions but they are often buried down in examples to the existing reference instead of surfaced in a nice section similar to Redux's documentation. These are all questions that are mostly left with either unclear answers or would require experimentation on the user's side, while I feel like they should all have been answered already.

For my part, most of my experience has been with NgRx, and while I have used Vuex in the past, I can't stop thinking that I might have used it in a terribly wrong manner.

What does the proposed API look like?

I wish to see an additional section added to the Vuex's guides. Something that is less about what API to use and more about why and how you want to use this API. A good first candidate to move over there is the Advanced > Form Handling section which already talk about "the Vuex way" of doing things. Then, I would love to see similar examples posted for the various questions I mentioned above. All things that would benefit to be, if not standardized, at least suggested as patterns that people could start to expect to see in Vuex applications.

I would gladly provide some answers to those questions by myself, but like I mentioned already, I found most of them through experimentation and I honestly don't feel like I would recommend most if not any of my answers to someone else... (which is just one more reason to have a central place for those patterns, really...)

Just looking around, the idea of standardizing how various things gave rise to multiple interesting projects within Redux, like the flux standard action, and then redux-actions, redux-promise and redux-rx or redux-toolkit. I expect such documentation could probably spur some similar efforts in Vuex, or at least help point out some existing third party efforts that might be good solutions to those common problems.

f-t-alves commented 2 years ago

I would love to see more examples of how Vuex works too, especially with TypeScript

I-Want-ToBelieve commented 2 years ago

Need more examples of using typescript with vue4.x in the documentation