r/node • • Jul 09 '22

Deno in 2022

Post image
809 Upvotes

177 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Jul 13 '22 edited Jul 13 '22

not sure how you came from fresh to solid. whatever, I am following soid for a while but not yet convinced, while it creates small bundle sizes, it lacks a proper ecosystem. e.g. I need an animation lib. the only i found is motion one at whopping 86lb gzipped lol. or state management and so on.

with sveltekit i miss jsx but bundlesize are as small and svelte is fully featured incl animation lib with spring animatinos, state management and so on.

so not totally sold on solid

1

u/besthelloworld Jul 13 '22

I was just giving context to who Ryan Carniato is, but that stream itself is about Fresh/Deno.

But yeah, I really dig Solid which is why I started following Ryan on YT. And I feel the same way about basically every framework without JSX now: no thanks. The power of the actual language while templating is a no brainer. It's also what Google is doing with both Flutter & Jetpack Compose and Apple is doing with SwiftUI. They're not in-language XML but they're just representing UI as a recursive object/function tree.

And I don't have anything in particular to offer you for an animation library for Solid... but I find it's built in state management is so good, you don't really need an outside library. You basically have Jotai and Zustand built in. You have Jotai because createSignal (Solid's useState equivalent), can be used globally outside of components which basically fulfills Jotais atom model. And then the built in Store has never not met my needs. The pleasantry of state management plus the performance are totally worth it for me to have to roll my own components and animations.

1

u/[deleted] Jul 13 '22

And I feel the same way about basically every framework without JSX now: no thanks.

yes and no. while JSX feels extremely natural, svelte's markup isn't bad either. it has some amenities but the overall package, is just way better. and one pro is that your code is very structured, e.g. bc only one component per file which i found odd at the beginning but after all everything is neat and tidy

one thing i dislike about how jsx is implemented are the hooks, i've the feeling that solid also took over some of this use... api design. did many years react and find them till today the most unintuitive and crappy named api ever. not sure how it's with solid

You basically have Jotai and Zustand built in.

nice, didn't know this. i am huge fan of their maintainer. you check out voltai too, it's forom the same guy and after thousands of lines of code working with all of them => voltai

1

u/besthelloworld Jul 13 '22 edited Jul 13 '22

Yeah that's all fair. I see a lot of people hate JSX for the opposite reasons and would prefer a string based templating language... but for me, that's the thing I don't want to saccrifice is the dynamic power of the language during templating.

And Solid has, I believe two hooks. They're both for contexts that are locked into hooks (useContext requires that you're inside of a context, and useTransition requires render state). But like, useState is createSignal and isn't locked to the requirements of hooks. Use effect becomes createEffect. You can use onMount and onCleanup as lifecycle functions attached to functional context. So if onCleanup is called inside a component, then it will fire when the component is being destroyed but if onCleanup is called inside a createEffect then it will fire for cleanup of that effect specifically.

Generally though, Solid is pretty different from React because state updates don't force the whole tree to rerun. Here's my favorite article explaining how that works. That's the article that really sold me on Solid.

And I can't find anything valled Voltai... checked NPM and search with "voltai react" or "voltai js." Are you sure that's the name?