You build a Yew frontend by creating a new Cargo project with the wasm32-unknown-unknown target, adding the yew dependency, and compiling with trunk or wasm-pack.
cargo new my-yew-app --lib
cd my-yew-app
cargo add yew wasm-bindgen
cargo install trunk
trunk serve --open
- Create a new library project and navigate into it.
- Add the
yewandwasm-bindgendependencies to yourCargo.toml. - Install the
trunkbuild tool globally via Cargo. - Run
trunk serveto compile your Rust code to WebAssembly and start a local development server.