Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot find function `start_app` in crate `yew`

Tags:

rust

yew

I'm trying to write a simple Rust web programming with Yew, this is main.rs source code :

use lat12::App;
fn main() {
    yew::start_app::<App>();
}

and this is a simple library :

use yew::prelude::*;

#[function_component(App)] 
pub fn app() -> Html {
    html! {
        <h1>{"Welcome to Rust in Yew using library"}</h1>
    }
}

and this is cargo.toml :

[package]
name = "lat12"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
yew = "0.20.0"

If I change version of yew to : "0.19.3" it can run smoothly, but if I use newest version ("0.20.0") it can't run with error message : "cannot find function start_app in crate yew",..... what should I do ?

like image 339
Darlina Avatar asked Oct 20 '25 14:10

Darlina


1 Answers

From the 0.19.0 to 0.20.0 migration guide:

Yew Renderer

start_app* has been replaced by yew::Renderer.

You need to enable feature csr to use yew::Renderer.

like image 188
cafce25 Avatar answered Oct 22 '25 03:10

cafce25