DEV Community

Discussion on: Vue's Darkest Day

Collapse
 
drcmda profile image
Paul Henschel • Edited

Hm, these points do not really ring for me. The thing that made hooks so neat is that you can compose them. I know you can do this here, too, but i have trouble understanding how this would go. In React there's a call order, which i don't see as a negative despite the memoization, imo it helps to establish linear intent. Also to me it seems thinking in lifecycles (mount/unmount) isn't ideal, too. With hooks you're dealing with what are essentially effects.

Here's an example, i wonder how something like this would look in Vue: twitter.com/dan_abramov/status/109... In that example you see how they're composed in a linear order, one feeding the other. Items go into a shuffle, then together with columns and width go into the grid, the grid goes into a transform. If these were all observables that just happen to be driven by some one-shot hooks, would you be able to glance over it like that and see the connection?

I'm honestly curious, overall i must say i like the direction Vue is now going.

Thread Thread
 
linusborg profile image
Thorsten Lünborg

I've tried to flesh out the Vue version here:

gist.github.com/LinusBorg/f4378944...

Make sure to read the README. I'm open to questions :)

Thread Thread
 
danielelkington profile image
Daniel Elkington • Edited

@linusborg Nice! You may want to change the third link in the README from a duplicate CodeSandbox link to dev.to/drcmda/comment/c7l9 🙂

Thread Thread
 
linusborg profile image
Thorsten Lünborg

Oh, thanks. Will do

Thread Thread
 
drcmda profile image
Paul Henschel • Edited

Nice! That helps a lot to understand the differences.

Thread Thread
 
linusborg profile image
Thorsten Lünborg

No, there's no implementation available yet, the proposal is still being discussed and not adopted

Thread Thread
 
liximomo profile image
liximomo

There is an implementation github.com/liximomo/vue-function-api

Thread Thread
 
linusborg profile image
Thorsten Lünborg

Right, we came across this userland implementation as well in the meantime, it's pretty cool :)

Considering all that's going on right now I haven't had the time to try it, and can't say wether I will find time to use it for bringing this example to life in the coming days.