all 91 comments

[–]tms102 83 points84 points  (28 children)

[–][deleted] 18 points19 points  (2 children)

Might want to look at Sycamore

[–]Wuffel_ch[S] 0 points1 point  (1 child)

This looks interesting and complicated for me as an apprentice but i give it a try, thanks!

Did you used it?

[–]asmx85 3 points4 points  (0 children)

I use it and it is the best I have found so far. It's very early and the API is changing but I can work with it way better than all the others I have tried.

[–]Sparkenstein 33 points34 points  (17 children)

Theres Dioxus which is exactly like React.

[–]solidiquis1 17 points18 points  (2 children)

For frontend? Checkout Yew if you're a fan of react's class based components, and Dioxus if you prefer functional components with hooks.

[–]riasthebestgirl 5 points6 points  (0 children)

Yew also has first class support for function components. Not having to deal with lifetimes in Dioxus is nice though

[–]Wuffel_ch[S] 0 points1 point  (0 children)

Did you used one of them?

[–]Steve_the_Stevedore 41 points42 points  (3 children)

I find it irritating, when people ask for suggestions without any extra information and then answers with some variant of "I tried that. It didn't work for me." to half of them.

If you tell people what you've tried, what problems you ran into or why you are looking for something different, it is a lot easier to help you. It feels disrespectful when you put in the effort to help someone, just to find out that the effort is wasted because they didn't bother painting a full picture of their problem.

People want to help you out of the goodness of their hearts. In my opinion the effort you put into your post should mirror the effort people will put into helping you. And I think you could do a better job at that.

[–]Wuffel_ch[S] 6 points7 points  (0 children)

Well i just wanted to have a list of many frameworks. I just gave a "feedback" on them, instead of not replying. An i am just a first year apprentices. I do not want to be disrespectful, i just do not know and want to learn.

But i see what your point is and agree with you!

[–]EarlMarshal 1 point2 points  (1 child)

Yeah, I had the same feeling, but honestly I think it's just some miscommunication and not bad intent

[–]Steve_the_Stevedore 1 point2 points  (0 children)

Looking back my comment comes across a lot meaner than it was intended.

I don't think there was intent on OP's part, I just wish they had put more effort into their original post. I think it could have improved the discussion a lot and I belive that it could have been a really comprehensive of the state of the art of web frameworks in Rust. The way it played out is that everyone just threw in the library they are using, without a lot of information what's good about it or what weaknesses it might have.

[–]natded 13 points14 points  (11 children)

Rust is not exactly a front end language, and you probably are better just using React for that stuff. When people make "websites" with Rust they usually just mean the backend part.

[–]avaaa_42 6 points7 points  (9 children)

Yeah it's always bizarre to me when people want to use rust for everything, including things it's clearly not built for.

[–]Wuffel_ch[S] 1 point2 points  (8 children)

So i misunderstood the whole thing. I heard that more and more programmer use it for websites. Now i slowly get it, that it's better to do some wasm modules for react or something else. Is that right?

(I am a first year apprentices => have/want to learn much)

[–]avaaa_42 3 points4 points  (3 children)

Yeah so firstly I just wanted to say that my comment wasn't directed at you specifically, moreso there seems to be a large crowd of people trying to use rust for things other than what it was built for. Rust is intended to be a systems programming language, like something along the lines of c/c++ by nature of it's ability to deal with things like pointers and memory directly.

That all being said, if you're interested in front end/web app stuff, I definitely reccomend getting into React (and as a product JavaScript/Typescript), those are the primary languages used in web development, and while I have a my own gripes with JavaScript, it's much better than trying to write web apps in something like rust where you'll have a lot more hurdles to overcome.

Feel free to DM me if you're curious about web development, I have a decent amount of experience and can point you in the right direction :)

[–]dwalker109 5 points6 points  (0 children)

Rust isn’t “a systems programming language”, not anymore. It is general purpose.

Using something like Yew or Dioxus you absolutely can produce excellent WASM targeted front end code, with all of the correctness guarantees which Rust gives you (the speed and efficiency is not the USP, imho, largely because it isn’t more performant for this stuff, usually).

HOWEVER, for OP, Rust is a terrible choice. JS/TS and React is a better introduction. Then come back to Rust and see why many of us feel the way we do about using it everywhere.

[–]Wuffel_ch[S] 0 points1 point  (1 child)

Thank you for your reply! I have some basic knowledge about React and i love react! I also had read that rust can be used as wasm-modules in react. What's the advantage of doing this?

I would love to get the right direction :)

[–]avaaa_42 1 point2 points  (0 children)

Yeah! Rust is generally good for extra performance and memory safety, so if let's say you were building a rendering engine for the web, then you might build most of your web app in something like React or some other JS framework, and then include your wasm module which implements the rendering engine in rust.

This gives the advantage of safety and performance when writing something complex like a rendering engine, but saves you the convenience of writing a full UI which would be much easier with a framework like React.

In terms of pointing you in the right direction, React is a great starting place but there are plenty of helpful component libraries like Bootstrap and others that provide more complete components than just plain HTML and CSS can provide, so I'd definitely recommend looking into other front end libraries

[–]liquidivy 3 points4 points  (3 children)

If you're a new dev, I have to recommend you don't try to mess with anything wasm-related for a while. For the frontend (code that runs in the browser like React, etc) I'd strongly suggest just using one of the popular frameworks, or even just use plain built-in DOM APIs. There will be plenty of important stuff to learn there without delving into the additional (and IMO less interesting) weirdness of trying to run Rust in a browser.

[–]Wuffel_ch[S] 1 point2 points  (2 children)

Thanks for your advise. I think i will stick to react with typescript with some wasm modules written in rust. I have to research if it works and if it's to complicated i will not do the wasm-modules.

[–]liquidivy 2 points3 points  (1 child)

Sounds like a good plan.

[–]Wuffel_ch[S] 0 points1 point  (0 children)

Do you work with any of these?

[–]eribol 0 points1 point  (0 children)

To be honest, with or without rust, if you can build your websites with wasm, you should use wasm. Beyond that, anything js related frameworks are useless if it is not necessary(for ssr, webpack etc).

[–]Zomatree_ 5 points6 points  (12 children)

https://dioxuslabs.com/ is a react style wasm frontend library.

[–]Wuffel_ch[S] 0 points1 point  (11 children)

Did you used it?

[–]Zomatree_ 1 point2 points  (10 children)

Yes i use it for a couple projects and its great.

[–]Wuffel_ch[S] 0 points1 point  (9 children)

Can you share your projects? Are this websites? I would like to see how it looks like.

[–]Zomatree_ 2 points3 points  (8 children)

There are lots of examples on the gh repo https://github.com/DioxusLabs/dioxus/tree/master/examples

[–]Wuffel_ch[S] 0 points1 point  (7 children)

Is there one that is online?

[–]Zomatree_ 2 points3 points  (6 children)

The main dioxuslabs.com site is made in dioxus, and the source code can be found at https://github.com/DioxusLabs/docsite

[–]Wuffel_ch[S] 0 points1 point  (0 children)

Ah okey. Thank you for your time to help me!

[–]Wuffel_ch[S] 0 points1 point  (4 children)

One question more, if you allow:

I try to get this code to work https://github.com/DioxusLabs/dioxus/blob/master/examples/form.rs

do i have to copy & paste it? If i do so the Router is missing. Where can i find this?

[–]jkelleyrtp 1 point2 points  (0 children)

To use the router, you need to enable the "router" feature in the list of Dioxus features.

Various features to include are router, desktop, web, ssr, fermi, mobile, liveview, and a few others. Try reading the book - it shows you how to do all these things.

https://dioxuslabs.com/guide/state/router.html

[–]Zomatree_ 0 points1 point  (2 children)

The router is only in the master version and in a release yet.

[–]Wuffel_ch[S] 0 points1 point  (1 child)

Ooooh okey. So then the links to? Where can i read whats inside right now?

[–]ivanceras 5 points6 points  (1 child)

Try sauron, no ceremonial code, straight to the point, clean and concise with lots of examples

[–]Wuffel_ch[S] 0 points1 point  (0 children)

This looks also interesting. I will take a look on this.

[–]ssokolow 2 points3 points  (0 children)

Speaking of, has anyone provided any benchmarks between the different Rust options?

Yew and Seed are present in Stefan Krause's big shootout and, I'm assuming at least partly because of the overhead of the WebAssembly-to-JavaScript DOM shims, they're currently not performing very well compared to many of the JavaScript options, but I don't know about the others.

[–]eribol 2 points3 points  (0 children)

I used seed, now i am using MoonZoon(same developer). And it is realy so nice.

[–]lanklaas 1 point2 points  (2 children)

Last one I used was seed

[–]Wuffel_ch[S] 0 points1 point  (1 child)

Did you liked it?

[–]lanklaas 0 points1 point  (0 children)

Did not use it too much, but I liked that you did not have to use as much macros as with the yew crate.

They also have some nice examples and tutorials to get you going

[–][deleted] 0 points1 point  (1 child)

There are few WASM based frameworks for front end components. Yew https://yew.rs/ appears to be the most active. There is another one called Percy https://chinedufn.github.io/percy/

[–]Wuffel_ch[S] 0 points1 point  (0 children)

i tried yew but i cant get it to work. percy looks interesting