🌍 Dev.to
Vue Composables: The Shared State Trap (+ Cheat Sheet)
You build a useCounter() composable, drop <Counter /> on the page twice, and click the first button. Both counters go up.
You didn't copy-paste a bug. You wrote twelve lines of completely ordinary-looking Composition API code, and Vue executed every one of them correctly. The surprise isn't a Vue bug — it's a gap in your mental model of what a composable actually is , and that gap is exactly where a much more expensive version of this same mistake lives: on a server, where "the oth...

![[Boost]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2096147%2Fcfb04d29-bd0a-4f15-9e93-594834b52f6b.jpg)