3 ms·
Curious how do you deal with state management in large application if you are only using small bits of vuex. I am writing this vue application where one compone
by codegeek 8y ago
Curious how do you deal with state management in large application if you are only using small bits of vuex. I am writing this vue application where one component has become so huge that I would like to break it into smaller components but then passing data around in props is a nightmare. So I then need to look into something like vuex. So how do you get away from that in a large app ?
- Townley 8y agoIt depends a lot on what you're hoping to do. There's a happy medium for a large app between "every component manages their own state/props and those of their children" and "every component is a stateless vessel for VueX data". I think if you're at the point where "passing data around in props is a nightmare" that's the pain point that VueX is meant to resolve, and it should feed into the solution. But following the principle of "components should manage their state without VueX if it's easy/convenient for them to do so" is a good way to avoid the global state becoming too unwieldy.
- keyle 8y agoThat's a problem you'll have with any of those frameworks. Personally I have endpoints that ask for the data at a component level and if they're small, they're being passed the data from the view that contains them.
- jaxn 8y agoIf you use GraphQL, then Apollo and it's local cache are a pretty amazing alternative to VueX
- Smithalicious 8y agoWhat exactly is your issue with props?