DEV Community

Cover image for How YOU can learn to use Svelte for your next JS project

How YOU can learn to use Svelte for your next JS project

Chris Noring on January 13, 2020

Follow me on Twitter, happy to take your suggestions on topics or improvements /Chris Svelte, I kept hearing the name more and more. It's suppo...
Collapse
 
khrome83 profile image
Zane Milakovic

Svelte does not support routing out of the box. The closest official solution is to use Sapper. Some other people have built client side routing libraries as well when using Svelte as a SPA.

Overall it’s a really good framework, and my personal favorite.

Collapse
 
softchris profile image
Chris Noring

Yea I'm using a 3rd party router myself.. Works ok :)

Collapse
 
khrome83 profile image
Zane Milakovic

Which one did you find luck with?

Thread Thread
 
softchris profile image
Chris Noring
Thread Thread
 
philnash profile image
Phil Nash

I just built my first full site with Svelte this weekend and svelte-routing worked nicely for me (I probably got a bit too far trying to write my own before reaching out to this library).

I'm enjoying the workflow so far. Even got pre-rendered static pages working too.

Thread Thread
 
khrome83 profile image
Zane Milakovic

How are you prerendering svelte? We used Sapper, but it has a collection of issues.

I have not tried Svelte as just a SPA yet. I wonder if I should...

Thread Thread
 
philnash profile image
Phil Nash

I took inspiration from this example: github.com/akaSybe/svelte-prerende...

I'll have to write up what I did when I have time.

Collapse
 
shaijut profile image
Shaiju T • Edited

Now we are searching for 3rd party router, in this case Isn't Angular better, all libraries in one place ? Is Angular is for large apps and React and Svelte for small apps ? What do you guys think ? @khrome83 @softchris

Collapse
 
softchris profile image
Chris Noring

It is the same with React, no official router. At one point there were 4 routers.. I would say this: there are two different mentalities here. Get everything you need = Angular vs React/Svelte = let the community build what's missing. Ultimately use what works for you. I see different audiences here for Angular I see an enterprise audience that is used to great tools/types etc.. with other frameworks it's more down the specific lead dev what choices are made on approach and which 3rd party library.. As I always I would say it depends... I've seen large React apps as well... :)

Collapse
 
batisteo profile image
Baptiste Darthenay

I slightly disagree here. I think the author of Svelte, Rich Harris, very liked jQuery because it had (nearly) everything included, and made Web development easy: everything was documented in one place, the jQuery API docs.
I think Svelte tends to get to this point, he already included a store and transitions. A router might be included at some point, if it doesn’t conflict with Sapper.

At the end, what you don’t use is not included in the bundler, so it a win/win for the developer and the end user!

Thread Thread
 
softchris profile image
Chris Noring

We'll just have to see how Svelte develops then :)

Thread Thread
 
shaijut profile image
Shaiju T • Edited

Good 😄 , So you mean In Angular and React what we don’t use is included in the bundle.js file ?

Thread Thread
 
softchris profile image
Chris Noring

Think you misunderstood, everyone is using tree-shaking.. What I think he meant was that Svelte will probably move in a direction where it becomes more of an app framework than a library, all critical parts should be there.

Collapse
 
khrome83 profile image
Zane Milakovic

Yeah I agree with Chris.

I will say that I see a lot of benefit for Svelte across organizations of any size. It’s just simply smaller bundle for users and less code overall.

Collapse
 
sunitk profile image
Sunit Katkar • Edited

Svelte looks interesting. Since the work I do requires tabular display of data with sorting and filtering like in jQuery Datatables, I will wait till such a component is available out of the box. Cannot have my team spend time building such components. We build lot of apps and have time for building apps by using out of the box components.

Collapse
 
softchris profile image
Chris Noring

have you tried ag grid? It should be able to give you what you need and I'm sure it works well with Svelte? ag-grid.com/example.php ag-grid.com/javascript-grid/

Collapse
 
sunitk profile image
Sunit Katkar

Thanks for the info. Will check it out.

Collapse
 
vintharas profile image
Jaime González García

Awesome! Thanks for the plug! :D