The Power of reactive + getter in table scenarios #13827
HaceraI
started this conversation in
General Discussions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
While exploring Vue 3's reactivity system, I discovered an interesting pattern that seems underutilized in the community: combining
reactive()
with getter methods for table row objects. This approach appears particularly powerful for scenarios where each table row needs auto-calculated fields, but I'm curious about the community's perspective on this pattern.The Pattern
Instead of managing computed properties at the component level, I create reactive row objects with embedded getters:
Advantages I've Observed
row.total
instead of managing separate computed propertiesConclusion
The reactive + getter pattern has made this incredibly clean to implement, but I want to ensure I'm not missing any drawbacks or better alternatives.
This pattern feels natural and powerful for table scenarios, yet I rarely see it discussed. I'm curious whether this is because:
I'd love to hear your thoughts and experiences!
Demo: Vue SFC Playground
Beta Was this translation helpful? Give feedback.
All reactions