[solved] Yew - Hello world doesn’t work

TL; DR: I get a blank page when following the tutorial when using yew.

Context: I would like to create a graphical application that could be used on any system without having to cross-compile. As far as I can tell wasm is exactly what I need. I was considering yew as the framework that I will be using.

When following the tutorial I’m stuck nearly at the beginning. When starting the development server to be more precise. From what I understand, the folder dist was created, and populated with what should be my hello-word. This includes dist/index.html that I opened in my browser (firefox, mac if this matters). That page is blank.

The command trunk serve outputted many green message, and no errors (I tried with yew = "0.18" in my Cargo.toml and it didn’t compiled, but with yew = { git = "https://github.com/yewstack/yew/" } it compiles fine). If I put some stuff in the index.html at the root of my repository, they are correctly copied by trunk into dist/index.html (I just need to refresh the page). If I put junk (like some invalid tag, or an expression no inside a pair of curly bracked) inside the html! macro in src/main.rs, then trunk correctly reports errors. However, valid code (like what I posted just bellow) isn’t visible in dist/index.html.

use yew::prelude::*;

fn app() -> Html {
    html! {
        <h1>{ "Hello World" }</h1> // <- this doesn’t appears in `dist/index.html`

fn main() {

Any help is welcome :slight_smile:

I did not saw that I had to open localhost:8080 and not dist/index.html.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.