DEV Community

Discussion on: Vue 3 Composition API – The Wrong Solution To The Right Problem

Collapse
 
jsn1nj4 profile image
Elliot Derhay • Edited

When I saw the composition API, I thought it could be a neat tool in the toolbox.

If we're talking about business logic in the view layer though, I have to agree—especially when the view layer is handled completely in the browser as in SPAs.

Before I heard about Vue a few years ago, I was learning Meteor. It was a fun tool to learn and I loved the idea of using a framework that was an SPA out of the box and used JS on both client and server. But there was a practice (even encouraged in the docs) of running some Meteor methods that would normally need to be run server-side to update MongoDB also on the client (the client side used MiniMongo as its data store).

So it was trying to do DB updates in both to give the appearance that the changes happened more quickly—and then the changes would be rolled back if the server side contradicted the change made client-side.

I really don't understand why exposing all of this to the browser is/was thought to be ok, so I definitely agree with you about keeping business logic separate.