[{"data":1,"prerenderedAt":100},["ShallowReactive",2],{"blog-en-\u002Fblog\u002Fvue-2-para-vue-3-composition-api":3},{"id":4,"title":5,"body":6,"date":87,"description":88,"extension":89,"meta":90,"navigation":91,"path":92,"seo":93,"stem":94,"tags":95,"__hash__":99},"blog_en\u002Fblog\u002Fvue-2-para-vue-3-composition-api.md","Moving from Vue 2 to Vue 3 without rewriting the way I think",{"type":7,"value":8,"toc":79},"minimark",[9,22,27,48,52,62,65,69,72,76],[10,11,12,13,17,18,21],"p",{},"My first impression of the Composition API and why the most important change isn't swapping ",[14,15,16],"code",{},"data"," for ",[14,19,20],{},"ref",".",[23,24,26],"h2",{"id":25},"the-first-impression","The first impression",[10,28,29,30,32,33,35,36,39,40,43,44,47],{},"When I started using Vue 3, the Composition API looked like just a new syntax: ",[14,31,16],{}," became ",[14,34,20],{}," or ",[14,37,38],{},"reactive",", ",[14,41,42],{},"computed"," was still there and ",[14,45,46],{},"methods"," became a function. Later I realized that the more interesting change was the possibility of organizing the component by responsibility.",[23,49,51],{"id":50},"options-api-and-composition-api","Options API and Composition API",[10,53,54,55,39,57,39,59,61],{},"In the Options API, related code can end up split across ",[14,56,16],{},[14,58,42],{},[14,60,46],{}," and lifecycle hooks. In small components that is very readable. In large components, a single feature ends up spread over several blocks.",[10,63,64],{},"With the Composition API, the state, actions and effects of the same capability can stay close together and be extracted into a composable. That doesn't automatically make every composable good. If it takes dozens of parameters, changes hidden state and mixes business rules with visual details, we have only moved the complexity from one file to another.",[23,66,68],{"id":67},"how-i-started-migrating","How I started migrating",[10,70,71],{},"I avoided converting everything at once. First I picked components with reusable logic, wrote small composables and added types to the inputs and outputs. Simple components stayed simple. The goal wasn't to use the new API everywhere, but to make responsibilities more visible.",[23,73,75],{"id":74},"conclusion-for-now","Conclusion for now",[10,77,78],{},"Vue 3 doesn't require abandoning what worked in Vue 2. The Composition API is more valuable when it helps to group behavior and reuse logic, not when it only serves to follow a syntax trend.",{"title":80,"searchDepth":81,"depth":81,"links":82},"",2,[83,84,85,86],{"id":25,"depth":81,"text":26},{"id":50,"depth":81,"text":51},{"id":67,"depth":81,"text":68},{"id":74,"depth":81,"text":75},"2023-03-22","First impressions of the Composition API in Vue 3: the gain isn't swapping data for ref, but organizing the component by responsibility.","md",{},true,"\u002Fblog\u002Fvue-2-para-vue-3-composition-api",{"title":5,"description":88},"blog\u002Fvue-2-para-vue-3-composition-api",[96,97,98],"vue","architecture","fundamentals","d5jOmnbKtAuCGP--IAn4FDfIZI9lWoMd51ckp7yAkdI",1794928449787]