4 ms·
Do you use pure svelte or with sapper? how is it compared to react?
by G4BB3R 6y ago
Do you use pure svelte or with sapper? how is it compared to react?
- nickreese 6y agoWe wrote our own SSG for https://elderguide.com https://elderguide.com. We tried Sapper but our data flow and routing needs were to complex and not a fit. Svelte is a dream compared to React. That said, I've never felt like React was the right solution for the problem. I've extensively used Gatsby and for static sites, React is absolutely overkill. For apps it can be nice. In both cases my go-to these days is Svelte.
- uxcolumbo 6y agoNice site and real snappy. I haven't used Svelte yet - but am interested. Can you explain a bit more about what you mean with your data flow and routing needs were too complex for Sapper. And what makes Svelte a dream compared to React?
- nickreese 6y agoSapper's data flow uses a file based routing system similar to /blog/[id].svelte becomes /blog/:id/. If you are familiar with Next.js then you'll recognize this. Our primary problem with Sapper is that we wanted our URL structure to be such that you can't tightly route a template/view by just looking at their URL. /senior-living/blog-post/ and /senior-living/nursing-home-name/ need to live side-by-side. This forced us to build our own custom routing system, what we call an "inverted router" for our SSG. Also we found it less than elegant to use DB queries with Sapper and had a lot of concerns about what was actually on the client and what wasn't. As for why we swear by Svelte: * Bundle size. For SEO focused sites React is overkill. * Stores compared to Mobx or other state management * $: reactivity * No css-in-js hacks required. Css is automatically scoped, but can be easily globally scoped. * Single file components are just beautiful. * We've built in the ability to SSR our entire site, but only hydrate the parts that need to be. This is a game changer for page size and not pushing your data twice to the client.
- uxcolumbo 6y agoThanks for clarifying. Is your custom built routing system open source? I can imagine the Svelte community could benefit from it.
- nickreese 6y agoWe're working on open sourcing our entire SSG in the next 3-4 months. As it currently stands the SSG is super opinionated and we did several things quite unconventionally, so we are validating some of our ideas by building out another site besides elderguide.com to make sure these decisions indeed work across a lot of use cases. Once this second site is out the door we want to add TS support natively to the SSG and then we'll release it.
- danr4 6y agoSounds very interesting. Any plans on open sourcing?
- jfengel 6y agoI just ran through the tutorial, and I really liked the $-for-reactivity part. That's clever and good. But then they introduced a whole new language for loops and control structures, and I really prefer JSX for that. JSX nails a sweet spot of bog-standard Javascript/Typescript, with enough HTML syntactic sugar to very natural web-pagey parts. As long as TS/JS is already in there, I'd rather use it everywhere. I don't know it well enough to know if that's a necessary feature, or if the language will evolve to something closer to my sensibilities. I will probably give it a try in the future, especially if I want something more performance focused. (The virtual DOM overhead is real and the separate state mechanism is far less elegant than Svelte's solution.)
- uxcolumbo 6y agoSvelte now supports TS https://svelte.dev/blog/svelte-and-typescript https://svelte.dev/blog/svelte-and-typescript
- Kabootit 6y ago> Single file components are just beautiful. Not only in structure, but how they compose. The typical top-down tree components composition is typical. What is not immediately obvious is how child components can expose functionality upstream. So simple.
- lurker42 6y agosubmitting your contact form without any filled in details throws a graphql mutation error :)