Quick Start
-
Create a new cargo project
cargo new my-frender-app cd my-frender-app
-
Add
frender
to dependencies inCargo.toml
.[dependencies] frender = "= 1.0.0-alpha.8"
-
Create
index.html
in the project root directory.<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>My frender App</title> <script src="https://unpkg.com/react@17/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script> <link data-trunk rel="rust" href="Cargo.toml" /> </head> <body> <div id="frender-root"></div> </body> </html>
-
Modify
src/main.rs
#![allow(unused)] fn main() { use frender::prelude::*; #[component(main(mount_element_id = "frender-root"))] fn Main() { rsx!( <div> "Hello, frender!" </div> ) } }
-
Run with
trunk
Install trunk and then execute:
trunk serve
Then you can navigate to
http://localhost:8080
to see your frender app.